下载地址:
https://www.percona.com/downloads/XtraBackup/LATEST/
为了方便起见本次安装使用yum源安装方式
1 安装yum源:
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-4/percona-release-0.1-4.noarch.rpm
2 安装libev:
yum install perl-DBD-MySQL
下面这个安装需要根据自己的操作系统,安装libev
wget ftp://rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/libev-4.15-1.el6.rf.x86_64.rpm
rpm -ivh libev-4.15-1.el6.rf.x86_64.rpm
3 安装xtrabackup:
yum install percona-xtrabackup-24
备份测试:
创建备份用户并授予权限:
create user xtrabk@'localhost' identified by 'onlybackup';
GRANT RELOAD, LOCK TABLES, REPLICATION CLIENT,PROCESS ON *.* TO xtrabk@'localhost';
只用全备恢复过程(成功测试):
备份:
innobackupex --defaults-file=/data/mysqldata/3306/my.cnf --user=system --password='welcome123' /data/mysqldata/backup
准备恢复:
innobackupex --apply-log /data/mysqldata/backup/2017-10-17_13-08-11
删除data和log目录下文件
执行恢复:
innobackupex --defaults-file=/data/mysqldata/backup/my.cnf --copy-back /data/mysqldata/backup/2017-10-17_13-08-11/