Recently I needed to restore a MMM (MySQL MultiMaster) cluster after both databases become corrupted for various reasons.  Evaluating the environment it was decided that we should use the current active node as a true state and use this as a replication point, and provide database backups so that transactions could be played back manually if required.

We use Pecona Xtrabackup for a large number of clients and this was the case this time as well.  I performed the backup completed the manual replication and got the nodes back in sync again.

In the aftermath the developers didn’t know how to work with the backup and so I decide to write up a little script to run up a second instance of MySQL and produce the backups for each database.

I must credit r1soft-idera who provided a script for a slightly different scenario that I had in a previous job for giving me the idea to write this script.

pxb2mysqldump.sh