单主模式
参数修改
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
binlog_checksum=NONE
log_bin=binlog
log_slave_updates=ON
binlog_format=ROW
master_info_repository=TABLE
relay_log_info_repository=TABLE
transaction_write_set_extraction =XXHASH64
loose-group_replication_group_name='5f6268dc-b17f-11e8-abfa-c03fd530ffff'
loose-group_replication_start_on _boot=off
loose-group_replication_group_seeds="150.0.32.236:24901,150.0.32.236:24902,150.0.32.236:24903"
loose-group_replication_ip_whitelist='150.0.32.236'
loose-group_replication_local_address='150.0.32.236:24902'
loose-group_replication_bootstrap_group=off
配置主节点
set sql_log_bin=0;
create user 'repl'@'%' identified by 'repl';
grant replication slave on *.* to 'repl'@'%';
flush privileges;
set sql_log_bin=1;
change master to master_user='repl',master_password='repl' for channel 'group_replication_recovery';
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group=OFF;
select * from performance_schema.replication_group_members;
配置备节点
set sql_log_bin=0;
create user 'repl'@'%' identified by 'repl';
grant replication slave on *.* to 'repl'@'%';
flush privileges;
set sql_log_bin=1;
change master to master_user='repl',master_password='repl' for channel 'group_replication_recovery';
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
START GROUP_REPLICATION;
多主模式
loose-group_replication_single_primary_mode=off
loose-group_replication_enforce_update_everywhere_checks=on
相关视图监控
performance_schema.replication_group_member_stats
performance_schema.replication_group_members
performance_schema.replication_connection_status
performance_schema.replication_applier_status
其他
流控
开启 group_replication_flow_control_mode=quota
group_replication_flow_control_applier_threshold=25000 (默认事务个数)
group_replication_flow_control_certifier_threshold=25000(默认事务个数)
关闭 group_replication_flow_control_mode='disabled'
备份和加节点时 关闭流控,防止事务延迟过多。