1.下载并安装percona-xtrabackup-24-2.4.6-2.el6.x86_64.rpm
2.如果安装失败 逐个安装以下rpm
yum -y install perl perl-devel libaio libaio-devel perl-Time-HiRes perl-DBD-MysqL
下载并安装MysqL-shared-compat-5.6.35-1.el6.x86_64.rpm
4.再次安装percona-xtrabackup-24-2.4.6-2.el6.x86_64.rpm成功
增量备份的原理就是,把增量目录下的数据,整合到全量目录下,然后在进行,全数据量的还原。
全量备份
1.在master上备份所需数据库
innobackupex --default-file=/etc/my.cnf --user=root --password=root --databases="sweetwater" /MysqL-backup/
3.停止slave的MysqL服务
rm -rf /var/lib/MysqL/ibdata*
rm -rf /var/lib/MysqL/ib_logfile*
rm -rf /var/lib/MysqL/sweetwater
rm -rf /var/lib/MysqL/ib_buffer_pool
rm -rf /var/lib/MysqL/xtrabackup_info
5.执行
innobackupex --user=root --copy-back --force-non-empty-directories /MysqL-backup/master_backup/2017-03-07_20-59-49/
7.启动MysqL服务
增量备份
1.master增量备份
innobackupex --default-file=/etc/my.cnf --user=root --apply-log --redo-only /MysqL-backup/master_backup/2017-03-07_20-59-49/
3.停止slave的MysqL服务
rm -rf /var/lib/MysqL/ibdata*
rm -rf /var/lib/MysqL/ib_logfile*
rm -rf /var/lib/MysqL/sweetwater
rm -rf /var/lib/MysqL/ib_buffer_pool
rm -rf /var/lib/MysqL/xtrabackup_info
rm -rf /var/lib/MysqL/xtrabackup_binlog_pos_innodb
5.执行
innobackupex --user=root --copy-back --force-non-empty-directories /MysqL-backup/master_backup/2017-03-07_20-59-49/
7.启动MysqL服务
原文链接:https://www.f2er.com/centos/377720.html