[SOLVED] how to do safe backup when VM or container runs a DBMS ?

dethegeek

Member
Oct 16, 2011
5
0
21
Hi

It is well known that DBMS require care to do reliable baclups. Let's assume I run a Mysql database in a KVM machine or a LXC container under Proxmox VE.

If I use Proxmox VE's features to do snapshots of my guests, I don't find anything to hook the begin of the backup process to automatically prepare the guest for such operation.

For example I want to lock and flush my tables before the snapshot occurs, then release locks as soon as possible once the shapshot is made.

My purpose would to achieve the process of the following page using backup feature provided by Proxmox VE.
https://www.lullabot.com/articles/mysql-backups-using-lvm-snapshots
 
Use the Guestagent to make backups also with the snapshot option in backups save.

Works very well. You can hook into the toolchain with the qemu guest agent and flush the tables. There is an example in the official qemu codebase:

https://github.com/qemu/qemu/blob/m...t-agent/fsfreeze-hook.d/mysql-flush.sh.sample

We adopted this to other rdbm systems, too. It works. Until there is an "official" way to do this with containers, we do it from the "outside" and snapshot the VMs afterwards.