Mysql Group Replication(MGR)搭建

1.准备机器(3台)
10.11.13.11 master
10.11.13.12 slave
10.11.13.241 slave
2.host 解析(3台)
vi /etc/hosts
10.11.13.11 hostname1
10.11.13.12 hostname2
10.11.13.13 hostname3

INSTALL PLUGIN group_replication SONAME ‘group_replication.so’;
3.设置集群参数(三个节点都执行)
set global binlog_checksum = NONE;
set global transaction_write_set_extraction = “XXHASH64”;
set global group_replication_start_on_boot = OFF;
set global group_replication_bootstrap_group = OFF;
set global group_replication_group_name =“aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa”;
set global group_replication_local_address = ‘10.11.13.11:6606’;
set global group_replication_group_seeds =‘10.11.13.11:6606,10.11.13.12:6606,10.11.13.13:6606’;
set global group_replication_single_primary_mode = ON;

vi /etc/my.cnf
binlog_checksum = NONE
transaction_write_set_extraction = “XXHASH64”;
loose-group_group_replication_start_on_boot = OFF;
loose-group_group_replication_bootstrap_group = OFF;
loose-group_group_replication_group_name =“aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa”;
loose-group_group_replication_local_address = ‘10.11.13.11:6606’;
loose-group_group_replication_group_seeds =‘10.11.13.11:6606,10.11.13.12:6606,10.11.13.13:6606’;
loose-group_group_replication_single_primary_mode = ON;

主上执行
SET SQL_LOG_BIN=0;
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON . TO ‘repl’@’%’ IDENTIFIED BY ‘repl’;
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER=‘repl’,MASTER_PASSWORD=‘repl’ FOR CHANNEL ‘group_replication_recovery’;
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION;
select * from performance_schema.replication_group_members;
SET GLOBAL group_replication_bootstrap_group=OFF;
从上执行
SET SQL_LOG_BIN=0;
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON . TO ‘repl’@’%’ IDENTIFIED BY ‘repl’;
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER=‘repl’,MASTER_PASSWORD=‘repl’ FOR CHANNEL ‘group_replication_recovery’;
START GROUP_REPLICATION;
select * from performance_schema.replication_group_members;

查看集群状态
select * from performance_schema.replication_group_members;

你可能感兴趣的:(mysql)