Main library execution CREATE DATABASE test CHARACTER SET utf8 COLLATE utf8_general_ci; use test; create table if not exists h1 (id int(10) PRIMARY KEY AUTO_INCREMENT,name varchar(50) NOT NULL); insert into test.h1 values(1,"wang"),(2,"guo"),(3,"yang"),(4,"he"); select * from test.h1; Test from library delete from test.h1 where id>3; ERROR 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement 1. Switch from single-master to multi-master mode 1.1. Stop group replication (execute on all MGR nodes): stop group_replication; set global group_replication_single_primary_mode=OFF; set global group_replication_enforce_update_everywhere_checks=ON; 1.2. Execute any mgr node: 186 SET GLOBAL group_replication_bootstrap_group=ON; START GROUP_REPLICATION; SET GLOBAL group_replication_bootstrap_group=OFF; 1.3、Then execute on other mgr nodes: 194 195 START GROUP_REPLICATION; 1.4. View mgr group information (view from any MGR node) SELECT * FROM performance_schema.replication_group_members; It can be seen that the status of all MGR nodes is online, the role is PRIMARY, and the MGR multi-master mode is successfully established. Verify the node data synchronization in MGR multi-master mode: Update data on MGR-node1: Update data on MGR-node2 Update data on MGR-node3 In MGR multi-master mode, all nodes can perform read and write operations. 2. Switch back to single-master mode 2.1. Stop group replication (execute on all MGR nodes): stop group_replication; set global group_replication_enforce_update_everywhere_checks=OFF; set global group_replication_single_primary_mode=ON; 2.2. Select a node as the master node and execute (186) on the master node: SET GLOBAL group_replication_bootstrap_group=ON; START GROUP_REPLICATION; SET GLOBAL group_replication_bootstrap_group=OFF; 2.3. Execute on the remaining nodes, that is, from the library nodes (194 195): START GROUP_REPLICATION; 2.4. View MGR group information (available on any MGR node): SELECT * FROM performance_schema.replication_group_members; Switch back to single-master mode, the master has read and write permissions, and the other two slave nodes are read-only and cannot write. Set the whitelist network segment of the MGR group cluster: Add the network segment where the node is located stop group_replication; set global group_replication_ip_whitelist="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"; Knowledge point expansion MySQL Group Replication (MGR) is a database high availability and high scalability solution introduced by MySQL in version 5.7.17. It is provided in the form of a plug-in and achieves the final consistency of distributed data. The features of MGR are summarized as follows:
The above is the detailed content of the detailed explanation of the knowledge points of MySQL MGR single-master and multi-master mode switching. For more information about MySQL MGR single-master and multi-master mode switching, please pay attention to other related articles on 123WORDPRESS.COM! You may also be interested in:
|
<<: Simple implementation method of two-way data binding in js project
>>: Solution to leaving gaps between BootStrap grids
After installing the database, if you accidentall...
1. Environment Ubuntu 16.04 running on a virtual ...
Today, let’s get straight to the point and talk a...
Table of contents BOM (Browser Object Model) 1. W...
Today I will talk to you about clearing floats. B...
Table of contents 1.parseInt(string, radix) 2. Nu...
This article shares the specific code of vue+elem...
environment Server: centos7 Client: window Deploy...
After MySQL 5.7.18 is successfully installed, sin...
When joining a Windows 2008 server subdomain to a...
Table of contents Preface Demonstration effect HT...
what is it? GNU Parallel is a shell tool for exec...
Sometimes we want to execute a command in a conta...
How to check the status of Linux firewall 1. Basi...
There are many ways to generate a global ID. Here...