[Mysql] mgr从节点down恢复过程遇到的问题


本文总阅读量

1、mgr集群有节点down掉,查看日志一台服务器(3)因网络问题与其他两个节点(1,2)断掉,3节点被踢出了集群

1
2
3
 [Warning] Plugin group_replication reported: 'Member with address wallet-mysql-2:3306 has become unreachable.'
[Warning] Plugin group_replication reported: 'Member with address wallet-mysql-1:3306 has become unreachable.'
[ERROR] Plugin group_replication reported: 'Member was expelled from the group due to network failures, changing member status to ERROR.'

2、登录节点3尝试重新启动group_replication:

1
2
mysql>stop group_replicaiton;
mysql>start group_replication;

3、查看集群成员状态

SELECT * FROM performance_schema.replication_group_members;

1
2
3
4
5
6
7
+---------------------------+--------------------------------------+----------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------+-------------+--------------+
| group_replication_applier | 6a41c0b6-8e3d-11e8-b076-000d3aa05296 | wallet-mysql-2 | 3306 | ONLINE |
| group_replication_applier | 71540a17-8e3d-11e8-8cee-000d3aa1d767 | wallet-mysql-1 | 3306 | ONLINE |
| group_replication_applier | 7dd813bf-8e3d-11e8-8d92-000d3aa1c31e | wallet-mysql-3 | 3306 | RECOVERING |
+---------------------------+--------------------------------------+----------------+-------------+--------------+

4、节点3正在进行恢复,与主库同步数据,但是恢复过程error.log出现了以下问题:

1
2
[ERROR] Error reading packet from server for channel 'group_replication_recovery': The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires. (server_errno=1236)
[ERROR] Slave I/O for channel 'group_replication_recovery': Got fatal error 1236 from master when reading data from binary log: 'The slave is connecting using CHANGE MASTER TO MASTER_AUTO_POSITION = 1, but the master has purged binary logs containing GTIDs that the slave requires.', Error_code: 1236

提示无法读取主库的binary log

5、尝试去在另一个节点从库2上,全量dump一份数据,在3节点上应用并重新启动mgr:

5.1、节点2操作:

1
shell>/data/mysql/bin/mysqldump --all-databases --set-gtid-purged=ON --single-transaction -uroot -P3306 -p > /tmp/alldb.sql

拷贝alldb.sql到节点3的/tmp目录

5.2、节点3操作:

1
2
3
4
mysql>stop group_replication;
mysql>reset master;
mysql>set global read_only=0;
mysql>source /tmp/alldb.sql

重新启动mysql数据库

1
/etc/init.d/mysql restart

将节点3加入mgr集群:

1
mysql>start group_replication;

查看集群成员状态,集群状态恢复:

1
2
3
4
5
6
7
8
9
mysql>SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------+-------------+--------------+
| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------+-------------+--------------+
| group_replication_applier | 6a41c0b6-8e3d-11e8-b076-000d3aa05296 | wallet-mysql-2 | 3306 | ONLINE |
| group_replication_applier | 71540a17-8e3d-11e8-8cee-000d3aa1d767 | wallet-mysql-1 | 3306 | ONLINE |
| group_replication_applier | 7dd813bf-8e3d-11e8-8d92-000d3aa1c31e | wallet-mysql-3 | 3306 | ONLINE |
+---------------------------+--------------------------------------+----------------+-------------+--------------+
3 rows in set (0.00 sec)
目录
  1. 1. 1、mgr集群有节点down掉,查看日志一台服务器(3)因网络问题与其他两个节点(1,2)断掉,3节点被踢出了集群
  2. 2. 2、登录节点3尝试重新启动group_replication:
  3. 3. 3、查看集群成员状态
  4. 4. 4、节点3正在进行恢复,与主库同步数据,但是恢复过程error.log出现了以下问题:
  5. 5. 5、尝试去在另一个节点从库2上,全量dump一份数据,在3节点上应用并重新启动mgr:
    1. 5.1. 5.1、节点2操作:
    2. 5.2. 5.2、节点3操作:

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog