If you don’t verify backups you may safely assume you don’t have them.
It happens often that MySQL backups can be invalid or broken due to a software bug or some hidden corruption. If you are lucky enough hours and days will be needed to resurrect a database from a bad backup copy. If you ran out of luck quota – it may lead to data loss, hence it is very important to verify your backups. Far from all companies do backups, even less do verify them. To make the verification problem easier we have added a “verify” command to the TwinDB Backup Tool .
What the command does is it takes a backup copy, restores it, prepares(applies redo logs, fixes permissions and so on) and runs a MySQL instance on it. Then it checks that the recovered database is healthy. You can verify the backups either on a same server where the backup was taken or on a dedicated “verification” machine.
# twindb-backup verify mysql --help Usage: twindb-backup verify mysql [OPTIONS] [BACKUP_COPY] Verify backup Options: --dst TEXT Directory where to restore the backup copy [default: /tmp/] --hostname TEXT If backup_copy is latest this option specifies hostname where the backup copy was taken. --help Show this message and exit.
backup_copyis a backup copy name. You can get it from
twindb-backup lsoutput. Or you can pass
latestfor verifying the most recent MySQL backup.
hostname. If you verify the backup on another machine you have to specify what host was the backup taken from. If you run it without specifying the hostname, it will use a hostname of the local machine.
dstis a directory for restore mysql backup. By default it’s
twindb-backup verify mysql /path/to/twindb-server-backups/master1/hourly/files/_home-2017-11-13_16_43_17.tar.gz --dst /var/lib/mysql
To verify a backup, twindb-backup gets it from destinations such as
SSH , or
Local . After this, twindb-backup runs innobackupex to restore the backup from archive.
This feature works transparently with both full and incremental backups.
Besides, if you configure twindb-backup tool on export data to DataDog (watch for our next post :)), you can monitor restore time and alert your team about invalid backups or if restore time breaks SLA.
The Backup Tools supports verification starting starting from version 2.15.0 that you can install from our packages repository .