We all know to take backup MySQL databases through Mysqldump options but here I am going to explain another tool called Xtrabackup to backup our MySQL databases without any disturbance to your Server.
We can download Xtrabackup from this link : http://www.percona.com/downloads/XtraBackup/
Xtrabackup RPM Installation:
In RPM there is 3 files:
1.Xtrabackup ( percona-xtrabackup-2.1.2-611.rhel6.x86_64.rpm )
2.Debug-files (percona-xtrabackup-debuginfo-2.1.2-611.rhel6.x86_64.rpm )
3.Test (percona-xtrabackup-test-2.1.2-611.rhel6.x86_64.rpm )
Download these above three files.
Installation :
Step 1:
$ rpm -Uvh percona-xtrabackup-2.1.2-611.rhel6.x86_64.rpm
Step 2:
$ rpm -Uvh percona-xtrabackup-debuginfo-2.1.2-611.rhel6.x86_64.rpm
Step 3:
$ rpm -Uvh percona-xtrabackup-test-2.1.2-611.rhel6.x86_64.rpm
After installed it check it whether it is installed or not by using,
$ yum list|grep percona
Here you can see the list for percona files was installed.
Take Backup Using Xtrabackup:
Add your data directory in my.cnf or my.ini file.
$ innobackupex --user=root --password=pa$$word --export /nfsdrive
/nfsdrive --> backup path.
Take compressed backup:
$ innobackupex --user=root --password=pa$$word --export --compress /nfsdrive
or
$ innobackupex --user=root --password=pa$$word --stream=tar ./ | gzip -c > /nfsdrive/backup.tar.gz
Restore Backup:
1.Stop mysql
2.Move your mysql data directory to other location.
3.Copy the backup from backup path to mysql data directory.
4.Start the server.
Now you can use your databases.
Note:
If you are using "--compress" option while taking backup.It will save in ".qp" format you need to extract it by download qpress and extract it by,
/path/qpress -d /backup_path/example.qp /backup_path
More details : http://www.percona.com/software/percona-xtrabackup