-->

DEVOPSZONES

  • Recent blogs

    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

    1. Stop the container.

      docker stop pmm-server
      
    2. Move the image.

      docker rename pmm-server pmm-server-backup
      
    3. Create a subdirectory (e.g., pmm-data-backup) and move to it.

      mkdir pmm-data-backup && cd pmm-data-backup
      
    4. Backup the data.

      docker cp pmm-data:/srv .


    Restore

    1. Stop the container.

      docker stop pmm-server
      
    2. Remove it.

      docker rm pmm-server
      
    3. Revert to the saved image.

      docker rename pmm-server-backup pmm-server
      
    4. Change directory to the backup directory (e.g. pmm-data-backup).

    5. Remove Victoria Metrics data folder.

      docker run --rm --volumes-from pmm-data -it percona/pmm-server:2 rm -r /srv/victoriametrics/data
      
    6. Copy the data.

      docker cp srv pmm-data:/
      
    7. 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
      
    8. Start the image.

      docker start pmm-server

    No comments