MGR Copy

CentOS7 configuration is as follows
Replication Group 5.7.22
MySQL5.7.22
installed slightly
Set / etc / hosts three db mapping server above, as follows:
192.168.1.101 MYDB1
192.168.1.102 MYDB2
192.168.1.103 mydb3
Database server is installed:
database server address directory data port-ID Server
192.168.1.101 (MYDB1) 3306 / App / mysqldata / 3306 / Data / 1013306
192.168.1.102 (MYDB2) 3306 / App / mysqldata / 3306 / Data / 1023306
192.168. 1.103 (mydb3) 3306 / app / mysqldata / 3306 / data / 1033306
In the three examples mysql mydb1, mydb2, mydb3 assigned Account:
mysql> SET SQL_LOG_BIN = 0;
mysql> * * the GRANT Of REPLICATION the TO SLAVE the ON 'repl'@'192.168.%' the IDENTIFIED BY 'the repl';.
Mysql> SET SQL_LOG_BIN = 1;
在3台my.cnf上面配置gtid:
[mysqld]
gtid_mode=ON
log-slave-updates=ON
enforce-gtid-consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=none
#group replication config
plugin-load = group_replication.so
transaction_write_set_extraction = XXHASH64
group_replication_start_on_boot = OFF
group_replication_bootstrap_group = OFF
group_replication_group_name = '__GROUP_UUID__'
group_replication_local_address = 'mydb1:6606'
group_replication_group_seeds = 'mydb1:6606,mydb2:6606,mydb3:6606'
group_replication_single_primary_mode = true
group_replication_enforce_update_everywhere_checks = false
[mysqld]
gtid_mode=ON
log-slave-updates=ON
enforce-gtid-consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=none
#group replication config
plugin-load = group_replication.so
transaction_write_set_extraction = XXHASH64
group_replication_start_on_boot = OFF
group_replication_bootstrap_group = OFF
group_replication_group_name = '__GROUP_UUID__'
group_replication_local_address = 'mydb2:6606'
group_replication_group_seeds = 'mydb1:6606,mydb2:6606,mydb3:6606'
group_replication_single_primary_mode = true
group_replication_enforce_update_everywhere_checks = false
[mysqld]
gtid_mode=ON
log-slave-updates=ON
enforce-gtid-consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=none
#group replication config
plugin-load = group_replication.so
transaction_write_set_extraction = XXHASH64
group_replication_start_on_boot = OFF
group_replication_bootstrap_group = OFF
group_replication_group_name = '__GROUP_UUID__'
group_replication_local_address = 'mydb3:6606'
group_replication_group_seeds = 'mydb1:6606,mydb2:6606,mydb3:6606'
group_replication_single_primary_mode = true
group_replication_enforce_update_everywhere_checks = false
--------------
group_replication_allow_local_disjoint_gtids_join=off
group_replication_member_weight=80
group_replication_unreachable_majority_timeout=5
group_replication_compression_threshold=131072
group_replication_transaction_size_limit=20971520

Mysql restart the three services
service mysql restart
mysql> show plugins;
+----------------------------+----------+--------------------+----------------------+---------+
| Name                       | Status   | Type               | Library              | License |
+----------------------------+----------+--------------------+----------------------+---------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
…………
| group_replication          | ACTIVE   | GROUP REPLICATION  | group_replication.so | GPL     |
+----------------------------+----------+--------------------+----------------------+---------+
45 rows in set (0.00 sec)

开始构建集群,在mydb1(master)上执行:
# 构建集群
CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='repl' FOR CHANNEL 'group_replication_recovery';
#开启group_replication
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group=OFF;
mysql> select * from performance_schema.replication_group_members;
mysql> select * from performance_schema.replication_group_member_stats\G
mysql> select * from performance_schema.replication_connection_status;
mysql> select * from performance_schema.replication_applier_status;
mydb2、mydb3上加入
CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='repl' FOR CHANNEL 'group_replication_recovery';
START GROUP_REPLICATION;
验证集群复制功能
create database test;
use test;
create table t(id int primary key auto_increment,name varchar(20));
insert into t(name) values ('allen');
insert into t(name) values ('bob');
select * from t;

The default mode is single master, if you are using a multi-master mode, it is necessary prior to the addition of the group parameter to set global group_replication_single_primary_mode = off;
Performed based on parallel primary key
SET Global slave_parallel_type = 'LOGICAL_CLOCK';
SET Global slave_parallel_workers = N;
SET Global slave_preserve_commit_order = ON;
Group the Replication during opening parallel copying, in claim must be set slave_preserve_commit_order is ON
to open this parameter ensures performed on Applier the same transaction commit order on the order of submission and source MySQL server
Forced removal of the failed member, only one of any of the list is provided on a member to
set global group_replication_force_members = 'mydb1: 6606 , mydb2: 6606';
Monitoring Group Replication of
status information Group Replication is stored in the following five performance_schema table, you can easily perform SQL query statement:
replication_group_members
replication_group_member_stats
replication_connection_status
replication_applier_status
Threads
查看主节点是哪个
show global status like "group_replication_primary_member";
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');
本节点执行的GTID
select @@global.gtid_executed\G
获取的GTID
SELECT Received_transaction_set FROM performance_schema.replication_connection_status WHERE Channel_name = 'group_replication_applier';

Group Replication MySQL replication is the future development direction of the
Group Replication creates a separate TCP port for communication, Group Replication MySQL server plug-ins on each connected together through this port, direct communication between any two. Transmission Binlog Event is not as asynchronous replication that is transmitted between the simple point to point. Group Replication during data transmission using a protocol Paxos. Paxos protocol to ensure consistency and atomicity of data transmission. Group Replication Paxos protocol built on a distributed replication mechanism of the state, which is multi-master replication of core technology. Group Replication in split-brain phenomenon does not occur. Group Replication of good redundancy, to ensure at least Binlog Event is copied to more than half of the members of the
single main modes: automatic members of the group elected the primary member. When initialization is initialized automatically members of the main members of the election, to join other members of the group from automatically become members. When the primary member fails or leaves the group, will elect a new primary members from the other members of the group. Select the primary member is simple, first of all online members UUID sort selected UUID as the smallest member of the main member of the
read-write mode for automatically switching
the Set Global super_read_only =. 1;
the Set Global super_read_only = 0;
Multi-master mode: when you start Group Replication plug-in, it detects whether the user has configured MySQL auto-incrementing variable. If the user does not configure these two variables (auto_increment_offset auto_increment_increment and are 1), the value is automatically group_replication_auto_increment_increment and server-id is set to MySQL auto_increment_increment global variables and auto_increment_offset
Note that when using mysqldump import gtid_purged

Test 1: MGR master node down
Test 2: MGR from a node goes down
tests 3: down at the same time more than half of the node from
the master node continuously down: Test 4
Test 5: the master node of the network jitter
Test 6: slave network jitter
test 7: master slave network partition
test 8: primary delay from the node in the network
test 9: master node KILL large transaction
test 10: processing MyISAM tables
test 11: support MGR the foreign key - a single master mode
test 12: mysqldump for MGR support
test 13: no primary key of the table support
test 14: gh-ost MGR support for the
test 15: pt-osc MGR support for the
test 16: xtrabackup support MGR's
17 test: binlog_format = statement of the impact

Guess you like

Origin www.cnblogs.com/allenhu320/p/11316766.html