PMMBackupRestore script updated to work with PMM3 (mostly)

@Naresh9999 had asked me to update the script I wrote for online backups of PMM server so it worked with 3.0…took a bit of doing given how much the internals changed between versions but I at least have something working! I haven’t tested enough that I’d say go use it on your prod PMM server but it’s done enough that you can do a backup and restore from/to the same version of PMM 3.x.

You can take a look here (make sure you’re looking at the 3.0 branch!) and I’d love some feedback. There is one thing to note…the new PMM3 architecture uses rootless containers which adds a tricky challenge to automate around. So to get this version working on PMM3 for backup (since there are packages that need to be installed) you’ll have to run it as root unless I can convince the team to bundle pigz in the base container. For the time being you’ll have to run it as root every time, but I think I can make it work that you only need to do it once for package installation, the first time, then can run as a cron job from then on as a non-root user.

For restores, there’s no way around running as root because you have to stop services.

So you can stage the file in your container with a docker cp backup.sh pmm-server:/srv/
then open a shell on your PMM server with docker exec -it –user 0 pmm-server bash and you can cd to /srv and run it.

1 Like

Hi, @steve.hoffman

Thanks for the update! I really appreciate you putting in the effort to get this working with PMM 3.0 despite all the internal changes. I’ll review the 3.0 branch and share feedback after some testing. The rootless container limitation and pigz install note are clear. I’ll keep those in mind while trying it out.