centos7安装Xtrabackup

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.自动备份写脚本

你可能感兴趣的:(Linux)