master上备份mysql
/data/Percona-5721/scripts/xtra_sohmysql_fullbak.sh
scp 备份文件到备机
关闭slave
service mysql stop
在slave服务器恢复
全备恢复:恢复注意恢复文件权限问题
tar -izxvf xxxx.tar.gz 注意加-i
innobackupex --defaults-file=/etc/my.cnf --apply-log /data/backup/xtrfull
service mysql stop
mv /data/Percona-5721/data /data/Percona-5721/data_bk
innobackupex --defaults-file=/etc/my.cnf --copy-back /data/backup/xtrfull
启动数据库注意mysql data文件的权限
chown -R mysql:mysql /data/Percona-5721/data
cp xtra_fullbak_zabbixmysql_my2018-12-03.cnf /etc/my.cnf
service mysql start 启动slave数据库
以下备机操作:
[root@sjgldb2 xtrfull]# cat xtrabackup_binlog_info
mysql-bin.000022 76037747 4738b030-3b8f-11e8-a130-a0369f9edff8:1-10232570
reset master;清除binlog和tran_id信息
set global gtid_purged="4738b030-3b8f-11e8-a130-a0369f9edff8:1-10232570";
change master to master_host='20.58.8.61',master_port=23306,master_user='repl',master_password='xxxx',master_auto_position=1;
start slave;