共计 846 个字符,预计需要花费 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;
: