#############MGR 必选参数#######################
server_id=1
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
binlog_checksum=NONE
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "10.10.203.147:24901"
loose-group_replication_group_seeds= "10.10.203.145:24901,10.10.203.146:24901,10.10.203.147:24901"
loose-group_replication_bootstrap_group= off
#### for performance_schema
performance_schema =on
performance_schema_consumer_events_stages_current=on
performance_schema_consumer_events_stages_history=on
performance_schema_consumer_events_stages_history_long=off
performance_schema_consumer_statements_digest=on
performance_schema_consumer_events_statements_current=on
performance_schema_consumer_events_statements_history=on
performance_schema_consumer_events_statements_history_long=off
performance_schema_consumer_events_waits_current=on
performance_schema_consumer_events_waits_history=on
performance_schema_consumer_events_waits_history_long=off
performance_schema_consumer_global_instrumentation=on
performance_schema_consumer_thread_instrumentation=on
#####MYSQL CMD#############################
SET SQL_LOG_BIN=0;
CREATE USER rpl_user@'%' IDENTIFIED BY '123456';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='123456' FOR CHANNEL 'group_replication_recovery';
INSTALL PLUGIN group_replication SONAME 'group_replication.so'; --第一次安装了之后就可以不用执行了
SET GLOBAL group_replication_bootstrap_group=ON; --只有作为SEED节点的机器才使用,否则所有的节点都默认为SEED节点了,坑
set global group_replication_allow_local_disjoint_gtids_join=1; --只在slave节点执行
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group=OFF;
SELECT * FROM performance_schema.replication_group_members;
select * from performance_schema.replication_connection_status\G
CREATE DATABASE test;
use test;
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 TEXT NOT NULL);
INSERT INTO t1 VALUES (1, 'Luis');
SHOW BINLOG EVENTS;
show global status like '%group_replication_primary%';
MGR的限制
仅支持InnoDB表,并且每张表一定要有一个主键,用于做write set的冲突检测;
必须打开GTID特性,二进制日志格式必须设置为ROW,用于选主与write set
COMMIT可能会导致失败,类似于快照事务隔离级别的失败场景
目前一个MGR集群最多支持9个节点
不支持外键于save point特性,无法做全局间的约束检测与部分部分回滚
二进制日志不支持binlog event checksum
错误解决:
##2018-07-10T06:17:00.054571Z 41 [ERROR] Slave I/O for channel 'group_replication_recovery': error connecting to master 'rpl_user@mha-slave1:3307' - retry-time: 60 retries: 1, Error_code: 2005
/etc/hosts中的IP解析出问题,修改后正常
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27799221/viewspace-2215656/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/27799221/viewspace-2215656/