学习是一个逐步发现自己无知的过程!

MGR加入组复制出错

加入复制组出现的错误代码 [3093]

当创建好MGR组之后,其他节点加入组过程中的错误进行解决

加入组时提示的错误:ERROR 3093 (HY000): The START GROUP_REPLICATION command failed since the group is already running.

mysql> START GROUP_REPLICATION;
ERROR 3093 (HY000): The START GROUP_REPLICATION command failed since the group is already running.

日志中对应的错误日志

[ERROR] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: 5b26904d-1f06-11ee-90eb-001c42fb6dbc:1-8 > Group transactions: 3320c37a-58ad-47fb-84bd-253fc05ccc3:1,
5b2da24b-1f06-11ee-91b2-001c426547c0:1-8'

[ERROR] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'

  • 这个错误提示是MySQL Group Replication(组复制)插件给出的。它表示当前成员节点的执行事务数量与组中其他节点报告的事务数量不匹配。

  • 表示当前成员节点包含了组中其他节点不存在的事务,因此该成员将退出组。

解决办法:

  1. 停止当前节点的组复制。在当前节点上执行以下命令:
    STOP GROUP_REPLICATION;

    2.在当前节点上执行以下命令,重置事务日志并清除已存在的事务:

    RESET MASTER;

    注意:执行此命令将删除当前节点的所有事务记录。确保在操作之前进行备份,并确保其他节点的事务日志与该节点同步。
    3.启动当前节点的组复制。在当前节点上执行以下命令:

    START GROUP_REPLICATION;

    这将使当前节点重新加入组,并尝试与其他节点进行数据同步。
    4.检查组复制是否恢复正常。可以使用以下命令验证:

    SELECT * FROM performance_schema.replication_group_members;

    如果所有节点的状态都显示正常,并且没有再次出现相关错误提示,那么组复制应该已经成功恢复。

加入复制组出现的错误代码 [3092]

执行加入代码时出现的报错

mysql> START GROUP_REPLICATION; 
ERROR 3092 (HY000): The server is not configured properly to be an active member of the group. Please see more details on error log.

日志中报错:

2023-07-19T09:31:34.004136Z 2 [Note] Plugin group_replication reported: 'Plugin 'group_replication' has been stopped.'
2023-07-19T09:32:25.422567Z 2 [Warning] Plugin group_replication reported: ''group_replication_allow_local_disjoint_gtids_join' is deprecated and will be removed in a future release.'
2023-07-19T09:32:37.978898Z 2 [Warning] Plugin group_replication reported: ''group_replication_allow_local_disjoint_gtids_join' is deprecated and will be removed in a future release.'
2023-07-19T09:32:37.979533Z 2 [Note] Plugin group_replication reported: 'Group communication SSL configuration: group_replication_ssl_mode: "DISABLED"'
2023-07-19T09:32:37.979796Z 2 [Warning] Plugin group_replication reported: '[GCS] Automatically adding IPv4 localhost address to the whitelist. It is mandatory that it is added.'
2023-07-19T09:32:37.979853Z 2 [Note] Plugin group_replication reported: '[GCS] SSL was not enabled'
2023-07-19T09:32:37.979873Z 2 [Note] Plugin group_replication reported: 'Initialized group communication with configuration: group_replication_group_name: "3320c37a-58ad-47fb-84bd-253fc05cccc3"; group_replication_local_address: "10.211.55.124:33061"; group_replication_group_seeds: "10.211.55.122:33061,10.211.55.123:33061,10.211.55.124:33061"; group_replication_bootstrap_group: false; group_replication_poll_spin_loops: 0; group_replication_compression_threshold: 1000000; group_replication_ip_whitelist: "127.0.0.1/8, 10.211.55.0/24"'
2023-07-19T09:32:37.979893Z 2 [Note] Plugin group_replication reported: '[GCS] Configured number of attempts to join: 0'
2023-07-19T09:32:37.979898Z 2 [Note] Plugin group_replication reported: '[GCS] Configured time between attempts to join: 5 seconds'
2023-07-19T09:32:37.979915Z 2 [Note] Plugin group_replication reported: 'Member configuration: member_id: 3; member_uuid: "5dc95b9a-2610-11ee-85e7-001c42b40983"; single-primary mode: "false"; group_replication_auto_increment_increment: 7; '
2023-07-19T09:32:37.980040Z 20 [Note] Plugin group_replication reported: 'Detected previous RESET MASTER invocation or an issue exists in the group replication applier relay log. Purging existing applier logs.'
2023-07-19T09:32:37.983207Z 20 [Note] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''.
2023-07-19T09:32:37.989415Z 2 [Note] Plugin group_replication reported: 'Group Replication applier module successfully initialized!'
2023-07-19T09:32:37.989456Z 23 [Note] Slave SQL thread for channel 'group_replication_applier' initialized, starting replication in log 'FIRST' at position 0, relay log './relay-bin-group_replication_applier.000001' position: 4
2023-07-19T09:32:37.989787Z 0 [Note] Plugin group_replication reported: 'XCom protocol version: 3'
2023-07-19T09:32:37.989797Z 0 [Note] Plugin group_replication reported: 'XCom initialized and ready to accept incoming connections on port 33061'
2023-07-19T09:32:40.188286Z 0 [ERROR] Plugin group_replication reported: 'Group contains 3 members which is greater than auto_increment_increment value of 2. This can lead to an higher rate of transactional aborts.'
2023-07-19T09:32:40.188516Z 26 [Note] Plugin group_replication reported: 'Establishing group recovery connection with a possible donor. Attempt 1/10'
2023-07-19T09:32:40.188552Z 0 [Note] Plugin group_replication reported: 'Group membership changed to mgr-3:3306, mgr-2:3306, mgr-1:3306 on view 16897568533495074:15.'
2023-07-19T09:32:40.195881Z 26 [Note] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. Previous state master_host='', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='mgr-1', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''.
2023-07-19T09:32:40.200175Z 26 [Note] Plugin group_replication reported: 'Establishing connection to a group replication recovery donor 5de510c0-2610-11ee-86a6-001c42423e4d at mgr-1 port: 3306.'

如上错误提示需要设置 group_replication_allow_local_disjoint_gtids_join参数

set global group_replication_allow_local_disjoint_gtids_join=ON;
START GROUP_REPLICATION;
  • 参数解释
    在Group Replication中,GTID(全局事务标识)用于跟踪各个服务器上的事务,并确保它们以相同的顺序和一致性进行应用。由于某些情况下,可能会导致GTID在组中不一致,MySQL默认不允许具有不一致GTID的服务器加入。
    通过执行set global group_replication_allow_local_disjoint_gtids_join=ON;命令,你可以允许具有不一致GTID的服务器加入Group Replication组。这在某些情况下可能是必需的,例如在进行故障恢复或添加新服务器时。
    通过检查状态后成功加入
    file

加入复制组提示网络问题

  • 具体报错日志如下
2023-09-04T09:12:16.066047Z 0 [Note] Plugin group_replication reported: 'Group membership changed to sh-mgr-01:3306, sh-mgr-02:3306 on view 16938109062647425:24.'
2023-09-04T09:12:16.066051Z 10 [Note] Plugin group_replication reported: 'Establishing group recovery connection with a possible donor. Attempt 1/10'
2023-09-04T09:12:16.071694Z 10 [Note] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. Previous state master_host='sh-mgr-02', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='sh-mgr-02', master_port= 3306, master_log_file='', master_log_pos= 4, master_bind=''.
2023-09-04T09:12:16.077578Z 10 [Note] Plugin group_replication reported: 'Establishing connection to a group replication recovery donor ad24046f-4ad5-11ee-bd94-0050568e321a at sh-mgr-02 port: 3306.'
2023-09-04T09:12:16.077804Z 11 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2023-09-04T09:12:16.078544Z 12 [Note] Slave SQL thread for channel 'group_replication_recovery' initialized, starting replication in log 'FIRST' at position 0, relay log './relay-bin-group_replication_recovery.000001' position: 4
2023-09-04T09:12:16.088078Z 11 [ERROR] Slave I/O for channel 'group_replication_recovery': error connecting to master 'rpl_user@sh-mgr-02:3306' - retry-time: 60  retries: 1, Error_code: 2005
2023-09-04T09:12:16.088102Z 11 [Note] Slave I/O thread for channel 'group_replication_recovery' killed while connecting to master
2023-09-04T09:12:16.088106Z 11 [Note] Slave I/O thread exiting for channel 'group_replication_recovery', read up to log 'FIRST', position 4
2023-09-04T09:12:16.088164Z 10 [ERROR] 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-09-04T09:12:16.088183Z 10 [ERROR] 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_replication_recovery.'
2023-09-04T09:12:16.088351Z 10 [Note] Plugin group_replication reported: 'Retrying group recovery connection with another donor. Attempt 2/10'
  • 可以看到在错误日志中,会通过集群用户去连接引导节点出现失败;
    手动测试连接也是失败,这里看到是通过数据库参数中report_host指定的节点名称作为主机信息、由于我的主机名并不是和参数中对应的,这里在hosts中添加解析配置即可解决。

    [ERROR] Slave I/O for channel 'group_replication_recovery': error connecting to master 'rpl_user@sh-mgr-02:3306' - retry-time: 60  retries: 1, Error_code: 2005
赞(0)
未经允许不得转载:劉大帥 » MGR加入组复制出错

你的评论可能会一针见血! 抢沙发

登录

找回密码

注册