提示信息:The group_replication_group_name option is mandatory
原因:变量group_replication_group_name必须在每个MGR成员中设置,并且保持一致
解决方法:如果是初始化集群,可以查询一个uuid()的值作为group_replication_group_name的值,如果是已经存在的集群,则到其他MGR节点查询该变量,并且在本节点设置
mysql> select uuid();
+--------------------------------------+
| uuid() |
+--------------------------------------+
| 0762c38f-e3dd-11ed-9fb3-00163ece3e28 |
+--------------------------------------+
1 row in set (0.01 sec)
mysql> set persist group_replication_group_name='0762c38f-e3dd-11ed-9fb3-00163ece3e28';
Query OK, 0 rows affected (0.00 sec)
mysql> select @@group_replication_group_name;
+--------------------------------------+
| @@group_replication_group_name |
+--------------------------------------+
| 0762c38f-e3dd-11ed-9fb3-00163ece3e28 |
+--------------------------------------+
1 row in set (0.00 sec)
复制代码
6.2 异常2
提示信息:[GCS] Invalid hostname or IP address () assigned to the parameter local_node!
原因:变量group_replication_local_address必须在每个MGR成员中设置,并且每个成员的值不一样
解决方法:参数group_replication_local_address设置规则为IP:PORT,一般是设置为本机IP,然后在实例端口前面加1作为MGR监听端口,即文章中的实例端口为3310,此时MGR监听端口设置为13310
mysql> set persist group_replication_local_address='172.17.140.25:13310';
Query OK, 0 rows affected (0.00 sec)
复制代码
6.3 异常3
提示信息:[GCS] Unable to join the group: peers not configured.
原因:变量group_replication_group_seeds必须在每个MGR成员中设置,并且保持一致
解决方法:设置格式为所有节点的group_replication_local_address值使用逗号拼接上
mysql> set persist group_replication_group_seeds='172.17.140.25:13310,172.17.140.24:13310,172.17.139.164:13310';
2023-04-26T11:06:32.048986+08:00 38 [ERROR] [MY-013117] [Repl] Slave I/O for channel 'group_replication_recovery': Fatal error: Invalid (empty) username when attempting to connect to the master server. Connection attempt terminated. Error_code: MY-013117
2023-04-26T11:06:32.179376+08:00 37 [ERROR] [MY-011582] [Repl] Plugin group_replication reported: 'There was an error when connecting to the donor server. Please check that group_replication_recovery channel credentials and all MEMBER_HOST column values of performance_schema.replication_group_members table are correct and DNS resolvable.'
2023-04-26T11:06:32.179493+08:00 37 [ERROR] [MY-011583] [Repl] Plugin group_replication reported: 'For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_rep
mysql> CHANGE MASTER TO MASTER_USER='mgr_sync', MASTER_PASSWORD='!QAZ2wsx' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected (0.01 sec)
复制代码
6.5 异常5
提示信息:执行start group_replication命令返回失败,在错误日志中存在如下信息
2023-04-26T11:27:14.610060+08:00 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: 0762c38f-e3dd-11ed-9fb3-00163ece3e28:1-7,
5301e31b-e3d6-11ed-bc14-00163ece3e28:1-8, e0e5b2f9-e3d8-11ed-86cf-00163e073778:1 > Group transactions: 0762c38f-e3dd-11ed-9fb3-00163ece3e28:1-7, 5301e31b-e3d6-11ed-bc14-00163ece3e28:1-8'
复制代码
原因:由于新加入的MGR节点存在本地事务,与MGR集群事务冲突,导致无法加入
解决方法有两种:
确认集群为新节点,并且本地操作未修改数据,可以直接重置本节点的GTID,再启动即可
## 在新节点中执行如下命令
mysql> reset master;
Query OK, 0 rows affected (0.03 sec)
mysql> start group_replication;
Query OK, 0 rows affected (2.06 sec)
复制代码
手动从其他正常节点进行数据clone,clone完成后,实例会自动重启,自动加入mgr组
mysql> set global clone_valid_donor_list='172.17.140.25:3310';
Query OK, 0 rows affected (0.00 sec)
mysql> set global super_read_only=off;
Query OK, 0 rows affected (0.00 sec)
mysql> clone instance from mgr_sync@172.17.140.25:3310 identified by '!QAZ2wsx';
Query OK, 0 rows affected (1.62 sec)
mysql> Restarting mysqld...
2023-04-26T03:37:53.502149Z mysqld_safe Number of processes running now: 0