group_replication_bootstrap_group 用于什么

来源:这里教程网 时间:2026-03-01 15:56:35 作者:

MGR中group_replication_bootstrap_group参数 有什么用途?何时使用?官方有解答:

What is the group_replication_bootstrap_group option used for?

The bootstrap flag instructs a member to create a group and act as the initial seed server.

The second member joining the group needs to ask the member that bootstrapped the group to dynamically change the configuration in order for it to be added to the group.

引导标志指示成员创建组并充当初始seed server,加入组的第二个成员需要请求引导组的成员动态更改配置,以便将其添加到组中。

A member needs to bootstrap the group in two scenarios. When the group is originally created, or when shutting down and restarting the entire group.

需要在两种情况下做设定:1.初始化建组时  2.关闭并重新启动整个组时

测试关闭重启整个MGR组(关闭所有成员):

在启动mysql各节点,执行开启MGR报错:

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.
mysql>  SELECT * FROM performance_schema.replication_GROUP_MEMBERS;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | eba0fa52-5dfb-11ea-9b8c-2c44fd7aadfc | MGRDB01     |        3306 | OFFLINE      |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
1 row in set (0.00 sec)

检查error log:

节点开始组复制后,会连接其他节点,获取信息,但是无法连接,因为此时集群中其他节点尚未开始组复制,集群中也没有主节点。

2021-06-02T18:29:47.090922+08:00 9 [Note] Plugin group_replication reported: 'Group communication SSL configuration: group_replication_ssl_mode: "DISABLED"'
2021-06-02T18:29:47.091511+08:00 9 [Note] Plugin group_replication reported: '[GCS] Added automatically IP ranges 192.168.16.113/23,127.0.0.1/8 to the whitelist'
2021-06-02T18:29:47.091868+08:00 9 [Warning] Plugin group_replication reported: '[GCS] Automatically adding IPv4 localhost address to the whitelist. It is mandatory that it is added.'
2021-06-02T18:29:47.091960+08:00 9 [Note] Plugin group_replication reported: '[GCS] SSL was not enabled'
2021-06-02T18:29:47.092003+08:00 9 [Note] Plugin group_replication reported: 'Initialized group communication with configuration: group_replication_group_name: "c7bce2ea-c7db-11ea-96e9-0050568acad3"; group_replication_local_address: "192.168.16.113:33062"; group_replication_group_seeds: "192.168.17.56:33061,192.168.16.113:33062"; group_replication_bootstrap_group: false; group_replication_poll_spin_loops: 0; group_replication_compression_threshold: 1000000; group_replication_ip_whitelist: "AUTOMATIC"'
2021-06-02T18:29:47.092110+08:00 9 [Note] Plugin group_replication reported: 'Member configuration: member_id: 2; member_uuid: "eba0fa52-5dfb-11ea-9b8c-2c44fd7aadfc"; single-primary mode: "true"; group_replication_auto_increment_increment: 7; '
2021-06-02T18:29:47.092943+08:00 11 [Note] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='<NULL>', master_port= 0, 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=''.
2021-06-02T18:29:47.119909+08:00 9 [Note] Plugin group_replication reported: 'Group Replication applier module successfully initialized!'
2021-06-02T18:29:47.119944+08:00 14 [Note] Slave SQL thread for channel 'group_replication_applier' initialized, starting replication in log 'FIRST' at position 0, relay log './swhEPODB02-relay-bin-group_replication_applier.000010' position: 4
2021-06-02T18:29:47.119971+08:00 9 [Note] Plugin group_replication reported: 'auto_increment_increment is set to 7'
2021-06-02T18:29:47.119992+08:00 9 [Note] Plugin group_replication reported: 'auto_increment_offset is set to 2'
2021-06-02T18:29:47.120154+08:00 0 [Note] Plugin group_replication reported: 'state 4338 action xa_init'
2021-06-02T18:29:47.120582+08:00 0 [Note] Plugin group_replication reported: 'Successfully bound to 0.0.0.0:33062 (socket=58).'
2021-06-02T18:29:47.120630+08:00 0 [Note] Plugin group_replication reported: 'Successfully set listen backlog to 32 (socket=58)!'
2021-06-02T18:29:47.120649+08:00 0 [Note] Plugin group_replication reported: 'Successfully unblocked socket (socket=58)!'
2021-06-02T18:29:47.120758+08:00 0 [Note] Plugin group_replication reported: 'Ready to accept incoming connections on 0.0.0.0:33062 (socket=58)!'
2021-06-02T18:29:47.120763+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.121005+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 59'
2021-06-02T18:29:47.121349+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.121480+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 56'
2021-06-02T18:29:47.121763+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.121944+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 62'
2021-06-02T18:29:47.122148+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.122281+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 63'
2021-06-02T18:29:47.122491+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.122633+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 66'
2021-06-02T18:29:47.122822+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.16.113 33062'
2021-06-02T18:29:47.122945+08:00 0 [Note] Plugin group_replication reported: 'client connected to 192.168.16.113 33062 fd 61'
2021-06-02T18:29:47.123146+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.123620+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.123679+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.123710+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.124096+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.124150+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.124175+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.124509+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.124564+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.124588+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.124858+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.124891+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.124912+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.125157+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.125190+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.125210+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.125529+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.125565+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.125585+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.125909+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.125941+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.125960+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.126198+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.126231+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.126250+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.126536+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.126571+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.126590+08:00 0 [Note] Plugin group_replication reported: 'connecting to 192.168.17.56 33061'
2021-06-02T18:29:47.126866+08:00 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.17.56 with error 111 -Connection refused.'
2021-06-02T18:29:47.126898+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.17.56:33061 on local port: 33062.'
2021-06-02T18:29:47.126920+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error connecting to all peers. Member join failed. Local port: 33062'
2021-06-02T18:29:47.127085+08:00 0 [Note] Plugin group_replication reported: 'state 4338 action xa_terminate'
2021-06-02T18:29:47.127140+08:00 0 [Note] Plugin group_replication reported: 'new state x_start'
2021-06-02T18:29:47.127157+08:00 0 [Note] Plugin group_replication reported: 'state 4338 action xa_exit'
2021-06-02T18:29:47.127603+08:00 0 [Note] Plugin group_replication reported: 'Exiting xcom thread'
2021-06-02T18:29:47.127630+08:00 0 [Note] Plugin group_replication reported: 'new state x_start'
2021-06-02T18:29:47.127693+08:00 0 [Warning] Plugin group_replication reported: 'read failed'
2021-06-02T18:29:47.172424+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33062'
2021-06-02T18:30:47.120129+08:00 9 [ERROR] Plugin group_replication reported: 'Timeout on wait for view after joining group'
2021-06-02T18:30:47.120214+08:00 9 [Note] Plugin group_replication reported: 'Requesting to leave the group despite of not being a member'
2021-06-02T18:30:47.120266+08:00 9 [ERROR] Plugin group_replication reported: '[GCS] The member is leaving a group without being on one.'
2021-06-02T18:30:47.120469+08:00 9 [Note] Plugin group_replication reported: 'auto_increment_increment is reset to 1'
2021-06-02T18:30:47.120493+08:00 9 [Note] Plugin group_replication reported: 'auto_increment_offset is reset to 1'
2021-06-02T18:30:47.121013+08:00 14 [Note] Error reading relay log event for channel 'group_replication_applier': slave SQL thread was killed
2021-06-02T18:30:47.121918+08:00 11 [Note] Plugin group_replication reported: 'The group replication applier thread was killed'

在节点上设置group_replication_bootstrap_group=on传输,再开启可以成功

mysql> set global group_replication_bootstrap_group=on;
Query OK, 0 rows affected (0.00 sec)
mysql> start group_replication;
Query OK, 0 rows affected (2.06 sec)
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-----------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST     | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-----------------+-------------+--------------+
| group_replication_applier | eba0fa52-5dfb-11ea-9b8c-2c44fd7aadfc | MGRDB01         |        3306 | ONLINE       |
+---------------------------+--------------------------------------+-----------------+-------------+--------------+
1 row in set (0.00 sec)

以上,

参考:

MySQL :: MySQL 5.7 Reference Manual :: 17.8 Frequently Asked Questions

MySQL MGR 宕机后如何开启复制_小楼一夜听春雨,深巷明朝卖杏花-CSDN博客

相关推荐