Category Archives: Dev Ops and Linux

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.

Linux: Find out whats using up your file system with these handy commands

Alas, there are so many good sites already that give you every kind of command line tip available for Linux. So why would I also post them? For absolutely no good reason that’s why!

I am betting you will have a better way, and that’s OK by me. Post it.

Here we go…

How can I see the top 10 largest directories in Linux? Try:

du -hsx * | sort -rh | head -10

Note the h option to sort may not work for you. This will give you human readable sizes.

How can I see what is using up my inodes? Try:

for i in `find . -type d `; do echo `ls -a $i | wc -l` $i; done | sort -n