rsnapshot and mysqldump

rsnapshot is a nifty little perl script for managing rsync backups in an easy way. rsync is great for backing up almost everything, but MySQL databases is an exception, since the files could get corrupted if data is not flushed and locked prior to backup.

To use mysqldump with rsnapshot the following script can be placed on the target machine (the machine being backed up). The script can of course be modified to use mysqlhotcopy instead of mysqldump, the principle is still the same.


A .my.cnf file also needs to be created on the target machine in the home folder of the backup user (probably root), with the following content. This is because we dont wont to pass the password as a command line argument (visible to other users).

Then use the following configuration for rsnapshot.

 
This assumes that SSH key authentication is already configured. Adjust path and user names accordingly.

2 comments for “rsnapshot and mysqldump

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.