Skip to content

Restore container

Summary
  • Stop and remove the container.
  • Restore (rename) the backup container.
  • Restore saved data to the data container.
  • Restore permissions to the data.

Important

You must have a backup to restore from.

To restore the container:

  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/postgres14 && \
    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/postgresql14.log
    
  8. Start the image.

    docker start pmm-server
    

Get expert help

If you need assistance, visit the community forum for comprehensive and free database knowledge, or contact our Percona Database Experts for professional support and services.