欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

centos7安装Xtrabackup

程序员文章站 2022-07-02 20:50:38
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.自动备份写脚本