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.自动备份写脚本
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。