每节点执行
1 install plugin group_replication soname 'group_replication.so';
install plugin clone SONAME 'mysql_clone.so';
2 set sql_log_bin=0;
create user repl_test@'%' identified WITH 'mysql_native_password' by 'repl_test';
GRANT REPLICATION SLAVE, REPLICATION CLIENT,BACKUP_ADMIN,CLONE_ADMIN ON *.* TO 'repl_test'@'%';
set sql_log_bin=1;
3 change master to master_user='repl_test',master_password='repl_test' for channel 'group_replication_recovery';
4 配置文件更改
常规参数
#并行复制相关
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=8
slave-preserve-commit-order=on
# GTID相关
gtid_mode=ON
enforce_gtid_consistency=ON
#binlog相关
binlog_checksum = NONE
transaction_write_set_extraction = XXHASH64
log_slave_updates=ON
#MGR参数-常规
group_replication_unreachable_majority_timeout=5
group_replication_compression_threshold=131072
group_replication_transaction_size_limit=20971520
group_replication_consistency=BEFORE_ON_PRIMARY_FAILOVER (8.0)
group_replication_exit_state_action = offline_mode(8.0)
loose-group_replication_group_name="01e5fb97-be64-41f7-bafd-3afc7a6ab555"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address="本地IP:13306"
loose-group_replication_group_seeds="IP1:13306,IP2:13306,IP3:13306"
loose-group_replication_bootstrap_group = off
loose-group_replication_ip_whitelist='10.255.74.0/24'
loose-group_replication_member_weight = 50
MGR 参数-clone相关参数
loose-group_replication_clone_threshold=50000 超过指定事务延迟数量后触发Clone Plugin重搭备库
loose-clone_autotune_concurrency=ON
loose-clone_max_concurrency=16
loose-clone_max_data_bandwidth=100
loose-clone_max_network_bandwidth=100
loose-clone_ddl_timeout=300
5 主节点启动
set global group_replication_bootstrap_group=ON;
START group_replication;
set global group_replication_bootstrap_group=OFF;
6 从节点执行
START group_replication;
7 查看状态
select * from performance_schema.replication_group_members; 都为online代表成功