1. 规划
2.设置mysql启动参数
#关于group replication 一些参数
master_info_repository = TABLE relay_log_info_repository = TABLE relay_log_recovery=1 gtid_mode = on enforce_gtid_consistency = 1 log_slave_updates = ON
server_id=1 #第一个节点是1 ,第二个节点是2 ...... transaction_write_set_extraction=XXHASH64 loose-group_replication_group_name="09440083-2b74-11ea-838b-549f3510fe78" loose-group_replication_start_on_boot=off loose-group_replication_local_address="172.18.12.2:23306" loose-group_replication_group_seeds="172.17.12.2:23306,172.17.12.3:23306,172.17.12.4:23306,172.17.12.5:23306,172.17.12.6:23306" loose-grup_replication_bootstrap_group=off
3.初始化:
mysqld --initialize
4.第一个节点启动
mysqld --defaults-file=/etc/my.cnf &
set sql_log_bin=0; create user 'rpl_user'@'%'; root@localhost 03:05: [(none)]> grant replication slave on *.* to rpl_user@'%' identified by '123456'; set sql_log_bin=1;
root@localhost 03:07: [(none)]> change master to master_user='rpl_user', master_password='123456' FOR CHANNEL 'group-replication_recovery';
安装group_replication插件
install plugin group_replication soname 'group_replication.so'; show plugins;
查看group相关参数
root@localhost 03:11: [(none)]> show global variables like '%group%';
设置第一个节点启动为on
set global group_replication_bootstrap_group=on;
启动mgr
start group_replication;
查看是否加入到组中
select * from performance_schema.replication_group_members;