MGR 驗證測試 mysql
架構:sql
10.0.1.111 10.0.1.147 10.0.1.192
MySQL [test]> select * from performance_schema.replication_group_members;bootstrap
+---------------------------+--------------------------------------+-------------+-------------+--------------+ | CHANNEL_NAME | MEMBER_ID | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE | +---------------------------+--------------------------------------+-------------+-------------+--------------+ | group_replication_applier | 9208c7e9-2300-11eb-84ce-fa163e3bdc68 | master | 3307 | ONLINE | | group_replication_applier | 922aea0f-2300-11eb-ade9-fa163e185828 | slave1 | 3307 | ONLINE | | group_replication_applier | 9234c4e6-2300-11eb-a184-fa163e313879 | slave2 | 3307 | ONLINE | +---------------------------+--------------------------------------+-------------+-------------+--------------+
2、多主切換到單主架構
一、中止組複製app
mysql> show variables like '%group_replication_enforce_update_everywhere_checks%'; +----------------------------------------------------+-------+ | Variable_name | Value | +----------------------------------------------------+-------+ | group_replication_enforce_update_everywhere_checks | ON | +----------------------------------------------------+-------+ 1 row in set (0.01 sec)
每一個節點執行:ide
mysql> set global group_replication_enforce_update_everywhere_checks=off; Query OK, 0 rows affected (0.00 sec) mysql> show variables like '%group_replication_single_primary_mode%'; +---------------------------------------+-------+ | Variable_name | Value | +---------------------------------------+-------+ | group_replication_single_primary_mode | OFF | +---------------------------------------+-------+ 1 row in set (0.01 sec) mysql> set global group_replication_single_primary_mode=on; Query OK, 0 rows affected (0.00 sec)
二、擇一個節點,打開 group_replication_bootstrap_group 爲 on,並開啓組複製,成功後再關閉測試
set global group_replication_bootstrap_group=on; start group_replication; set global group_replication_bootstrap_group=off;
另外兩個節點逐一開啓組複製,加入集羣環境,並經過視圖查看集羣狀況code
start group_replication; select * from performance_schema.replication_group_members; #查看 Primary 成員 select *from performance_schema.replication_group_members where member_id =(select variable_value from performance_schema.global_status WHERE VARIABLE_NAME= 'group_replication_primary_member');