mysql MGR single master multiple master mode switch

Primary library to perform
the CREATE DATABASE Test the CHARACTER the SET UTF8 the COLLATE utf8_general_ci;
use Test;
Create Table h1 of IF Not EXISTS (ID int (10) the AUTO_INCREMENT a PRIMARY KEY, name VARCHAR (50) the NOT NULL);
INSERT INTO test.h1 values (. 1, " Wang "), (2," Guo "), (. 3," Yang "), (. 4," of He ");
SELECT * from test.h1;

from the test library
Delete from test.h1 WHERE ID>. 3;
ERROR 1290 (HY000): IS of the Server running with the MySQL the Read-only Option - SUPER-SO IT CAN Not execute the this Statement

. 1, a single master switch to multiple master mode
1.1, stopping replication group (MGR performed on all nodes):
sTOP group_replication ;
SET Global group_replication_single_primary_mode = OFF;
SET Global group_replication_enforce_update_everywhere_checks the ON =;

1.2, a random node performs mgr: 186
The GLOBAL group_replication_bootstrap_group the ON = the SET;
the START GROUP_REPLICATION;
the SET group_replication_bootstrap_group the GLOBAL = OFF;

1.3, and then perform other nodes mgr: 194 195
the START GROUP_REPLICATION;

1.4, see mgr set information (MGR any node view)
the SELECT * the FROM performance_schema.replication_group_members;

enlarge MGR to all node status is online, the characters are pRIMARY, MGR build a successful multi-master mode.
MGR verify the multimaster mode data synchronization nodes:
update data MGR-node1 nodes:
update data MGR-node2 nodes
in the node update data MGR-node3
under MGR multimaster mode, all nodes can read and write.

2, switchback single master mode
2.1, stop replicon (performed on all MGR nodes):
sTOP group_replication;
sET Global group_replication_enforce_update_everywhere_checks = OFF;
sET Global group_replication_single_primary_mode = the oN;

2.2, select a node as a master node, performing (186 on the master node ):
The GLOBAL group_replication_bootstrap_group the ON = the SET;
the START GROUP_REPLICATION;
the SET group_replication_bootstrap_group the GLOBAL = OFF;

2.3, in the remaining nodes, is performed from the library node (194 195):
the START GROUP_REPLICATION;

2.4, can be viewed on the view MGR group information (any node MGR ):
the SELECT * the fROM performance_schema.replication_group_members;

cut back to a single master mode, the master has read and write access, read-only non-writable from the other two nodes.


whitelist segment cluster group MGR: adding a node network where the

STOP group_replication;
sET group_replication_ip_whitelist = Global "127.0.0.1/32,172.16.60.0/24,172.16.50.0/24,172.16.51.0/24";
Start group_replication;
Show Variables like "group_replication_ip_whitelist";

Guess you like

Origin www.cnblogs.com/xiefugui/p/12388860.html