How to Backup and Restore PMM(Percona Monitoring and Management) server Data
In this article we will see how to backup and restore PMM (Percona Monitoring and Management) data.
Backup
Stop the container.
docker stop pmm-server
Move the image.
docker rename pmm-server pmm-server-backup
Create a subdirectory (e.g.,
pmm-data-backup
) and move to it.mkdir pmm-data-backup && cd pmm-data-backup
Backup the data.
docker cp pmm-data:/srv .
Restore
Stop the container.
docker stop pmm-server
Remove it.
docker rm pmm-server
Revert to the saved image.
docker rename pmm-server-backup pmm-server
Change directory to the backup directory (e.g.
pmm-data-backup
).Remove Victoria Metrics data folder.
docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 rm -r /srv/victoriametrics/data
Copy the data.
docker cp srv pmm-data:/
Restore permissions.
docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R root:root /srv && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/alertmanager && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R root:pmm /srv/clickhouse && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R grafana:grafana /srv/grafana && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/logs && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R postgres:postgres /srv/postgres && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/prometheus && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R pmm:pmm /srv/victoriametrics && \ docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 chown -R postgres:postgres /srv/logs/postgresql.log
Start the image.
docker start pmm-server
No comments