Xtrabackup is a tool for data backup to InnoDB and supports online hot backup.
1. Install percona warehouse
yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
2. Install xtrabackup
yum install percona-xtrabackup -y
3. Create a backup user and set permissions
CREATE USER ‘bkpuser’@'localhost' IDENTIFIED BY 'password';
GRANT RELOAD,LOCK TABLES,PROCESS,REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost';
FLUSH PRIVILEGES;
4. Configure xtrabackup
vim /root/.my.cnf
[xtrabackup]
user=bkpuser
password=password
5. Perform a full backup
xtrabackup --backup --target-dir=/data/backups/mysql/full_backup
6. Perform the first incremental backup on the baseline of the full backup
xtrabackup --backup --target-dir=/data/backups/mysql_increase1 --incremental-basedir=/data/backups/mysql/full_backup
7. Every subsequent incremental backup is based on the previous incremental backup
xtarbackup --backup --target-dir=/data/backups/mysql_increase2 --incremental-basedir=/data/backups/mysql_increase2
8. Automatic backup script