Xtrabackup是一個對InnoDB做數據備份的工具,支持線上熱備份。 1.安裝percona倉庫 yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4 ...
Xtrabackup是一個對InnoDB做數據備份的工具,支持線上熱備份。
1.安裝percona倉庫
yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
2.安裝xtrabackup
yum install percona-xtrabackup -y
3.創建備份用戶及設置許可權
CREATE USER ‘bkpuser’@'localhost' IDENTIFIED BY 'password';
GRANT RELOAD,LOCK TABLES,PROCESS,REPLICATION CLIENT ON *.* TO 'bkpuser'@'localhost';
FLUSH PRIVILEGES;
4.配置xtrabackup
vim /root/.my.cnf
[xtrabackup]
user=bkpuser
password=password
5.執行一次全備份
xtrabackup --backup --target-dir=/data/backups/mysql/full_backup
6.在全備份的基準上執行第一次增量備份
xtrabackup --backup --target-dir=/data/backups/mysql_increase1 --incremental-basedir=/data/backups/mysql/full_backup
7.往後的每一次增量備份都以上一次增量備份為基準
xtarbackup --backup --target-dir=/data/backups/mysql_increase2 --incremental-basedir=/data/backups/mysql_increase2
8.自動備份寫腳本