To turn on replication configuration:
Server-id=1 #标识服务器唯一
Log-bin=mysql-bin #二进制日志开启
Enforce_gtid_consistency = on #GTID模式是组复制的基础技术
binlog-format=row #必须是ROW模式
Gtid-mode= on#GTID保证事物编号全局唯一 (Global Transaction ID)
master-info-repository=TABLE
< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" > Relay-log-info-repository=table #记录同步的信息 for easy administration and recovery
log-slave-update= On #需要记录事务的binlog, used for later recovery, even if not the write point, also need
Binlog-checksum=none #MGR本身不支持binlog的checksum校验
To turn on group configuration:
Transaction_write_set_extraction = XXHASH64 #哈希算法loose-group_replication_group_name = " 00e575aa-0cc0-11e8-9186-0050569341db " # Group name, format loose-group_replication_start_on_boot = off # Group replication is not started automatically at mysqld startup loose-group_replication_local_address = "10.103.16.31:24901" #本机的IP地址及端口loose-group_ Replication_group_seeds = "10.103.16.34:24901,10.103.16.35:24901,10.103.16.31:24901"
Main execution:
Change MASTER to Master_user= ' stemp ', master_password= ' 123456 ' for CHANNEL ' group_replication_recovery '; INSTALL PLUGIN Group_replication SONAME ' group_replication.so '; set global group_replication_allow_local_disjoint_gtids_join=on; START group_replication;
Other main executions:
INSTALL PLUGIN group_replication SONAME ' group_replication.so '; START group_replication;
To view node information:
SELECT * from Performance_schema.replication_group_members;
Modify node information online:
Global group_replication_group_seeds= ';
To set the multi-master mode:
Server2,server3:
STOP group_replication; SET GLOBAL Group_replication_single_primary_mode=false; SET GLOBAL group_replication_enforce_update_everywhere_checks=true;
SERVER1:
STOP group_replication; SET GLOBAL Group_replication_single_primary_mode=false; SET GLOBAL group_replication_enforce_update_everywhere_checks=true; SET GLOBAL Group_replication_bootstrap_group=on; START group_replication; SET GLOBAL Group_replication_bootstrap_group=off;
Then Server2,server3:
SET GLOBAL Group_replication_bootstrap_group=on; START group_replication; SET GLOBAL Group_replication_bootstrap_group=off;
MySQL Group Replication (Multi-master synchronous replication Mgr)