----------centos 7安装xtrabackup8.0.4---------------------------
1.下载
#8.0版本
$ wget https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-8.0.4/binary/redhat/7/x86_64/percona-xtrabackup-80-8.0.4-1.el7.x86_64.rpm
2.安装
yum localinstall percona-xtrabackup-80-8.0.4-1.el7.x86_64.rpm
卸载命令如下:
yum remove percona-xtrabackup
3.使用备份
rpm的安装方式默认安装路径为:/usr/bin/xtrabackup
/usr/bin/xtrabackup --defaults-file=/opt/mha/mysql8/conf/my.cnf --host=localhost --user=root --password=mysql --port=13306 --socket=/opt/mha/mysql8/mysql.sock --backup --target-dir=/opt/mha/xbackup/
-------------异地恢复----------------------
1.将备份文件拷贝到目的机器
[root@localhost mha]# tar -cvf xbackup.tar ./xbackup/
[root@localhost mha]# scp xbackup.tar root@192.168.1.135:/opt/mha/
2.解压到指定目录
[root@localhost bin]# mkdir -p /opt/mha/xbackup/
[root@localhost xbackup]# tar -xvf xbackup.tar
3.停掉需要恢复的数据库
/opt/mha/mysql8/bin/mysqladmin -h 127.0.0.1 -uroot -P13306 -S /opt/mha/mysql8/mysql.sock shutdown
4.备份之前的数据文件目录,并创建一个空目录
[root@localhost mysql8]# cd /opt/mha/mysql8
[root@host02 mysql5718]# mv data bakdata
[root@host02 mysql5718]# mkdir data
6.准备
xtrabackup --host=localhost --user=root --password=mysql --port=13306 --prepare --target-dir=/opt/mha/xbackup/xbackup/
xtrabackup --defaults-file=/opt/mha/mysql8/conf/my.cnf --user=root --prepare --target-dir=/opt/mha/xbackup/xbackup/
7.拷回数据:
xtrabackup --defaults-file=/opt/mha/mysql8/conf/my.cnf --user=root --copy-back --target-dir=/opt/mha/xbackup/xbackup/
8.修改目录属性启动数据库:
-----------------------------
问题1:遇到的问题:
Populating InnoDB table cache.
Allocated tablespace ID 1 for sys/sys_config, old maximum was 0
xtrabackup: Unknown error 3613
xtrabackup: Unknown error 3613
xtrabackup: Unknown error 3613