1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| # 1. 备份数据库文件 mysqldump -h 192.168.1.xx -P 3306 -uroot -pxxxx2023! --single-transaction --master-data=2 --flush-logs --flush-privileges --events --routines --all-databases > all_backup.sql
# 2.在可疑成员库上停止加入MGR集群 stop group_replication;
# 3. 备库重置gtid_executed reset master; show global variables like '%gtid%';
# 4. 设置可读写 set global super_read_only=OFF;
# 5. 恢复数据 mysql -h 192.168.1.xx -P 3306 -uroot -pxxxx2023! </home/sql_bak/all_databases-202312212350.sql
# 6. 加入MGR集群 start group_replication;
# 7. 设置只读 show global variables like 'super%'; set global super_read_only=ON; #加入MGR集群后为只读状态
# 8. 查看集群状态 SELECT * FROM performance_schema.replication_group_members;
|