Percona Monitoring and Management 2 Docker Created Without pmm-data? No Problem!

Disclaimer: This blog post is about migrating Percona Monitoring and Management 2 (PMM) data between PMM2 versions, and not for migrating data from PMM1 to PMM2. Restoring data from PMM1 to PMM2 is NOT supported since there were many architectural changes.

 

PMM Docker Container Pmm-dataI recently worked on a customer case where he was not using a pmm-data container mounted in /srv as instructed in the official doc. PMM2 data is stored under /srv (changed from PMM1, which stored data in other directories and had different mounts for pmm-data), which means that if the content of /srv is not mounted on a separate container, upgrade or recreation of pmm-server will lose the existing data.

The procedure of backing up data stored in pmm-server and recreating pmm-server + pmm-data containers with the correct mount in /srv and no data loss is described below, but first, you should check if pmm-data is correctly mounted:

Checking if pmm-data is Holding /srv:

If you are using pmm-data container mounted on “Destination: /srv/”, you should see the following outputs while checking pmm-data:

And if pmm-server is using pmm-data, then the volume filename “Source” should match the one from pmm-data:

 

If you are not using pmm-data mounted in /srv, then the output will be showing a different mount (or no mount at all) such as:

 

Backup Existing Data

 

Restore Into a New pmm-data Mounted in /srv:

 

Results should be similar to this:

Finally, pmm-server needs to be restarted so that it reloads files with correct permissions:

Docker should now be working again with no data loss! And the backup of the containers  can be safely removed with:

 

Conclusion

It’s strongly suggested to use a separate pmm-data container mounted in /srv for PMM2 to avoid loss of historical data when upgrading/recreating pmm-server. Since the data path for PMM changed in PMM2 compared to PMM1, you might be using a pmm-data container with the wrong mounts (or no pmm-data at all!) which can be easily fixed by using the above procedure.

Share this post

Comment (1)

  • Phani Reply

    Hi Carlos,

    Can you kindly let me know how to get the O.S metrics like CPU,MEMORY for a cloudsql instance in pmm2

    June 22, 2020 at 11:29 am

Leave a Reply