1.在当前主节点创建全量备份(MySQLdump或xtrabackup): # /usr/bin/innobackupex --defaults-file=/etc/my.cnf --user=root --password='xxxx' /data/backup 2.停止故障实例的MySQL # mysqladmin -uroot -p shutdown 3.清空当前数据
1.在当前主节点创建全量备份(MySQLdump或xtrabackup):
# /usr/bin/innobackupex --defaults-file=/etc/my.cnf --user=root --password='xxxx' /data/backup
2.停止故障实例的MySQL
# mysqladmin -uroot -p shutdown
3.清空当前数据目录
备注:清空前备份一下
4.恢复全量备份到故障实例:
#/usr/bin/innobackupex --defaults-file=/etc/my.cnf --user root --socket=/tmp/mysql.sock --apply-log /data/backup
#/usr/bin/innobackupex --defaults-file=/etc/my.cnf --user root --socket=/tmp/mysql.sock --move-back /data/mysql
5.启动MySQL:
#mysqld_safe --user=mysql &
6.更新GTID_PURGE
mysql> RESET MASTER;
mysql> RESET SLAVE ALL;
mysql> SET SQL_LOG_BIN=OFF;
mysql> SOURCE datadir/backup_gtid_executed.sql
mysql> SET SQL_LOG_BIN=ON;
mysql> CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';
启动组复制:
mysql> START GROUP_REPLICATION;
7.检查节点状态:
mysql> SELECT * member_host, member_port, member_state FROM performance_schema.replication_group_members;