MGR single_primary 切换 Muti-Primary 模式
root@localhost [(none)]>select * from performance_schema.replication_group_members;+---------------------------+--------------------------------------+-------------+-------------+--------------+| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |+---------------------------+--------------------------------------+-------------+-------------+--------------+| group_replication_applier | 33a6c4f8-a67a-11e8-b7f6-0050568beaf6 | db211 | 3507 | ONLINE || group_replication_applier | 951678d2-91a2-11e8-be71-0050568be82c | db210 | 3507 | ONLINE || group_replication_applier | abac4f08-a683-11e8-9447-0050568b744a | db212 | 3507 | ONLINE |+---------------------------+--------------------------------------+-------------+-------------+--------------+3 rows in set (0.00 sec)root@localhost [(none)]>set global group_replication_single_primary_mode=1;ERROR 3093 (HY000): Cannot change into or from single primary mode while Group Replication is running.root@localhost [(none)]>stop group_replication;Query OK, 0 rows affected (9.28 sec)root@localhost [(none)]>set global group_replication_single_primary_mode=0;Query OK, 0 rows affected (0.00 sec)root@localhost [(none)]>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.root@localhost [(none)]>
- 查看error.log日志: 也就是说,需要所有节点都关闭后修改一致再启动.
2018-08-23T16:58:19.616446+08:00 0 [ERROR] Plugin group_replication reported: 'The member configuration is not compatible with the group configuration. Variables such as single_primary_mode or enforce_update_everywhere_checks must have the same value on every server in the group. (member configuration option: [], group configuration option: [group_replication_single_primary_mode]).'
- 所有节点stop group_replication并设置root@localhost [(none)]>set global group_replication_single_primary_mode=0;再逐一启动:
root@localhost [(none)]>set global group_replication_single_primary_mode=0;Query OK, 0 rows affected (0.00 sec)root@localhost [(none)]>set global group_replication_bootstrap_group=1;Query OK, 0 rows affected (0.00 sec)root@localhost [(none)]>start group_replication;Query OK, 0 rows affected (2.01 sec)root@localhost [(none)]>最后一个节点:root@localhost [(none)]>set global group_replication_single_primary_mode=0;Query OK, 0 rows affected (0.01 sec)root@localhost [(none)]>start group_replication;Query OK, 0 rows affected (3.14 sec)root@localhost [(none)]>select * from performance_schema.replication_group_members;+---------------------------+--------------------------------------+-------------+-------------+--------------+| CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |+---------------------------+--------------------------------------+-------------+-------------+--------------+| group_replication_applier | 33a6c4f8-a67a-11e8-b7f6-0050568beaf6 | db211 | 3507 | ONLINE || group_replication_applier | 951678d2-91a2-11e8-be71-0050568be82c | db210 | 3507 | ONLINE || group_replication_applier | abac4f08-a683-11e8-9447-0050568b744a | db212 | 3507 | ONLINE |+---------------------------+--------------------------------------+-------------+-------------+--------------+3 rows in set (0.00 sec)root@localhost [(none)]>show global variables like '%single%';+---------------------------------------+-------+| Variable_name | Value |+---------------------------------------+-------+| group_replication_single_primary_mode | OFF |+---------------------------------------+-------+1 row in set (0.00 sec)