> On Nov 23, 2020, at 12:33, John Smiley <
jrsm...@gmail.com> wrote:
>
> What do you recommend to automate backup and recovery for a MySQL fleet then?
John,
I use Percona's XtraBackup (
https://www.percona.com/software/mysql-database/percona-xtrabackup) and a wrapper script that knows how to package and upload a backup file from my EC2 instances to S3 for backups.
For restores, I've written another wrapper script that downloads a backup package from S3 and uses Percona Toolkit tooling to move the data files in place automatically, starting up MySQL at the end.
I also have a separated script that knows how to hook up a server to replication, including retrieving replication credentials from Vault or AWS Secrets Manager.
Last but not least important, I have another script that checks a given MySQL server replication and, while it is still lagging behind drops consistency settings in the server with "SET GLOBAL sync_binlog = 0 , innodb_flush_log_at_trx_commit = 0;" for as long as it takes for that server to catch up with replication. The same script maintains a flag file in the disk to signal other systems (like my load-balancer health checks) that this particular database is lagging behind too much and is currently not suitable for resolving queries in production.
Unfortunately all this is very specific to my environment and I would be hard-pressed to make it all available as open-source software the way it is now.
I hope this gives you ideas about where to start.
Kind regards,
--
LMC