Using Percona’s Xtrabackup to back up MySQL to “remote” host

Quick note about one method to back up MySQL database to another host. There are lots of ways to do this but I use this one the most. Note: you should read and fully understand how to use Xtrabackup. Please read at Percona’s site.

Xtraback up can now use qpress, but I have just not had luck with qpress and so still use the ever trusty pigz. In addition to pigz you will need netcat ( nc).

On the destination hosts ( the host where you want to send the back up to) cd into your directory where you want to create the back up:

cd /mybackups/

and run:

nc host 1234 | gunzip | tar ixvf -

where host is the hostname or ipaddress of the server you want to back up.

 

On host you want to back up ( note: I would recommend this be a slave of the actual master but depending on engine type and size you could do this on master). 

cd to data directory and run

innobackupex --user=user --password=password  --stream=tar ./ | pigz | nc -l 1234

 

you should now see your back up running and sending its copy to remote host.

 

If you are not using Percona’s tools, or you need MySQL support I HIGHLY recommend Percona. They are fantastic.