MySQL 5.7.19组复制搭建

------------------------------TigerLiu的技术园地([email protected])--------------------------------

参考文档:

搭建步骤:https://www.cnblogs.com/manger/p/7211932.html
参数配置:http://shift-alt-ctrl.iteye.com/blog/2269539

官方文档:https://dev.mysql.com/doc/refman/5.7/en/group-replication.html

环境:redhat linux6.5   MySQL5.7.19  Xtrabackup2.4.8

搭建3节点组复制集群具体如下:(笔者在实验环境中搭建,两台虚拟机其中115起了两个实例,生产环境建议实例分布在不同的机器上)

IP                       端口号  主机名

192.168.56.117  3306    SlaveSed

192.168.56.115  3306    SlaveFri

192.168.56.115  3307    SlaveFri

搭建思路:

1、配置参数文件,将组复制参数配好

2、安装组复制插件

3、配置组复制

    a、117-3306原库配置

    b、使用xtrabackup初始化115-3306及115-3307节点

    c、115-3306及115-3307配置

4、组复制同步测试

5、组复制数据全局一致性测试

6、组复制宕机及恢复测试

7、错误总结

========================================正文分割线================================================

1、配置参数文件:

关键参数:

server-id = 1  每个主机不要一样
relay_log_info_repository=TABLE
master_info_repository=table
binlog_checksum=NONE
log_slave_updates=ON
binlog_format=ROW
gtid_mode=ON
transaction_write_set_extraction=XXHASH64
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212889f851' #组的名字可以随便起,所有节点必须一致,但不能用主机的GTID
loose-group_replication_start_on_boot = off  #为了避免每次启动自动引导具有相同名称的第二个组,所以设置为OFF。
loose-group_replication_bootstrap_group = off #同上
loose-group_replication_local_address = '192.168.56.117:33061' #写自己主机所在IP
loose-group_replication_group_seeds ='192.168.56.117:33061,192.168.56.115:33061,192.168.56.115:33071'
loose-group_replication_single_primary_mode = off  #关闭单主模式的参数
loose-group_replication_enforce_update_everywhere_checks = on #开启多主模式的参数


117-3306实例:

[mysqld3306]
#auto-rehash
#default-character-set=utf8
socket=/tmp/mysql.sock
server-id=1
gtid_mode=on
enforce_gtid_consistency=on
log-slave-updates=1
binlog_format=row
replicate-ignore-db=information_schema
replicate-ignore-db=mysql
replicate-ignore-db=performance_schema
replicate-ignore-db=sys
replicate-ignore-db=dmm_170401
replicate-ignore-db=sqlauditbo
skip_slave_start=1
sync_master_info = 1
sync_relay_log = 1
sync_relay_log_info = 1
relay_log_recovery = 1
log-bin=/binlog/mysql-bin
sync_binlog=1
innodb_support_xa=1
port=3306
basedir=/usr/local/mysql
datadir=/home/mysql/data/
log-error=/usr/local/mysql/mysqld.log
pid-file=/home/mysql/data/mysqld.pid
default-time-zone = '+8:00'
group_concat_max_len=102400
max_allowed_packet = 4M
max_connections=1000
character-set-server=utf8
lower_case_table_names=1
event_scheduler = 1
sql-mode=''
query_cache_size=0
max_heap_table_size=96M
tmp_table_size=96M
long_query_time=1
################semi sync replication settings 56#################
plugin_dir = /usr/local/mysql/lib/plugin
plugin_load ="rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
rpl_semi_sync_master_enabled=1
rpl_semi_sync_slave_enabled=1
rpl_semi_sync_master_timeout=5000
relay_log_info_repository=TABLE
master_info_repository=table
#innodb
default-storage-engine =innodb
innodb_io_capacity=1000
innodb_open_files = 500
innodb_doublewrite=0
innodb_file_format=Barracuda
innodb_flush_log_at_trx_commit=1
innodb_file_per_table=1
innodb_log_buffer_size=8M
innodb_log_file_size=128M
innodb_buffer_pool_size=256M
innodb_write_io_threads = 2
innodb_read_io_threads = 2
innodb_thread_concurrency= 0
innodb_purge_threads = 0
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
#myisam
bulk_insert_buffer_size = 512M
myisam_sort_buffer_size = 512M
myisam_max_sort_file_size = 1G
myisam_repair_threads = 1
#slow query log
slow_query_log=ON
slow_query_log_file=/home/mysql/data/SlaveSed-slow.log
long_query_time=10
log_queries_not_using_indexes=0
########group replication##############
relay_log_info_repository=TABLE
master_info_repository=table
binlog_checksum=NONE
log_slave_updates=ON
binlog_format=ROW
gtid_mode=ON
transaction_write_set_extraction=XXHASH64
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212889f851'
loose-group_replication_start_on_boot = off
loose-group_replication_bootstrap_group = off
loose-group_replication_local_address = '192.168.56.117:33061'
loose-group_replication_group_seeds ='192.168.56.117:33061,192.168.56.115:33061,192.168.56.115:33071'
loose-group_replication_single_primary_mode = off
loose-group_replication_enforce_update_everywhere_checks = on


115-3306实例:

[mysqld3306]
port                           = 3306
socket                         = /home/mysql/data/mysql.sock
# GENERAL #
user                           = mysql
default-storage-engine         = InnoDB
pid-file=/home/mysql/data/mysqld.pid
server-id                      = 2
tmpdir                         = /mysqltmp/
log-error=/usr/local/mysql/mysqld.log
character_set_server           = utf8
default-time-zone              = '+8:00'
max_allowed_packet             = 4M
event_scheduler                = 1
# MyISAM #
key-buffer-size                = 32M
bulk_insert_buffer_size = 512M
myisam_sort_buffer_size = 512M
myisam_max_sort_file_size = 1G
myisam_repair_threads = 1
# SAFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000000
sql-mode                       =
sysdate-is-now                 = 1
innodb                         = FORCE
# DATA STORAGE #
datadir                        = /home/mysql/data/
#datadir                        = /home/mysql/dataUp/
# BINARY LOGGING #
log-bin                        = /binlog/mysql-bin
expire-logs-days               = 30
sync-binlog                    = 1
lower_case_table_names         = 1
binlog_format                  = row
max_binlog_size                = 1073741824
# CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 2000
thread-cache-size              = 128
open-files-limit               = 65535
table-definition-cache         = 4096
table-open-cache               = 4096
# INNODB #
query_cache_size               = 0
max_heap_table_size            = 96M
tmp_table_size                 = 96M
long_query_time                = 1
innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 128M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 1G
innodb_write_io_threads        = 8
innodb_read_io_threads         = 8
innodb_purge_threads           = 4
innodb_buffer_pool_instances   = 3
innodb_stats_on_metadata       = OFF
join_buffer_size               = 262144
sort_buffer_size               = 262144
innodb_support_xa              = 1
default-storage-engine =innodb
innodb_io_capacity=1000
innodb_open_files = 500
innodb_doublewrite=0
innodb_file_format=Barracuda
innodb_thread_concurrency= 0
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
# LOGGING #
log-error                      = /home/mysql/data/mysql-error.log
log-queries-not-using-indexes  = 1
slow-query-log                 = 1
slow-query-log-file            = /home/mysql/data/mysql-slow.log
# REPLICATION #
slave_compressed_protocol      = on
sync_relay_log_info            = 10000
log-slave-updates              = 1
relay-log                      = /home/mysql/data/relay-bin
relay_log_recovery             = 1
binlog_gtid_simple_recovery    = 1
slave-net-timeout              = 60
sync_master_info               = 1
sync-relay-log                 = 1
sync-relay-log-info            = 1
master_info_repository         = TABLE
relay_log_info_repository      = TABLE
slave_skip_errors              = ddl_exist_errors
binlog_checksum=NONE
replicate-ignore-db=information_schema
replicate-ignore-db=mysql
replicate-ignore-db=performance_schema
replicate-ignore-db=sys
replicate-ignore-db=dmm_170401
replicate-ignore-db=sqlauditbo
# semi sync replication settings #
plugin_dir                     = /usr/local/mysql/lib/plugin
plugin_load                    = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
rpl_semi_sync_master_enabled   = 1
rpl_semi_sync_slave_enabled    = 1
rpl_semi_sync_master_timeout   = 5000
# GTID #
gtid_mode                      = on
enforce_gtid_consistency       = on
# SLOW LOG #
slow_query_log=ON
#slow_query_log_file=/home/mysql/data/SlaveSed-slow.log
long_query_time=5
########group replication##############
relay_log_info_repository=TABLE
master_info_repository=table
binlog_checksum=NONE
log_slave_updates=ON
binlog_format=ROW
gtid_mode=ON
transaction_write_set_extraction=XXHASH64
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212889f851'
loose-group_replication_start_on_boot = off
loose-group_replication_bootstrap_group = off
loose-group_replication_local_address = '192.168.56.115:33061'
loose-group_replication_group_seeds ='192.168.56.117:33061,192.168.56.115:33061,192.168.56.115:33071'
loose-group_replication_single_primary_mode = off
loose-group_replication_enforce_update_everywhere_checks = on
group_replication_ssl_mode=REQUIRED
####################### SLAVE PARAMETER #####################
#read_only=1
#super_read_only=1
####################### mysql 57 #####################
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=4
rpl_semi_sync_master_wait_point = after_sync
rpl_semi_sync_master_wait_for_slave_count = 1


115-3307实例:

[mysqld3307]
port                           = 3307
socket                         = /home/mysql/dataUp/mysql.sock
# GENERAL #
user                           = mysql
default-storage-engine         = InnoDB
pid-file                       = /home/mysql/dataUp/mysqld.pid
server-id                      = 3
tmpdir                         = /mysqltmp/
log-error=/usr/local/mysql/mysqld.log
character_set_server           = utf8
default-time-zone              = '+8:00'
max_allowed_packet             = 4M
event_scheduler                = 1
# MyISAM #
key-buffer-size                = 32M
bulk_insert_buffer_size = 512M
myisam_sort_buffer_size = 512M
myisam_max_sort_file_size = 1G
myisam_repair_threads = 1
# SAFETY #
max-allowed-packet             = 16M
max-connect-errors             = 1000000
sql-mode                       =
sysdate-is-now                 = 1
innodb                         = FORCE
# DATA STORAGE #
datadir                        = /home/mysql/dataUp/
# BINARY LOGGING #
log-bin                        = /binlog/3307/mysql-bin
expire-logs-days               = 30
sync-binlog                    = 1
lower_case_table_names         = 1
binlog_format                  = row
max_binlog_size                = 1073741824
# CACHES AND LIMITS #
tmp-table-size                 = 32M
max-heap-table-size            = 32M
query-cache-type               = 0
query-cache-size               = 0
max-connections                = 2000
thread-cache-size              = 128
open-files-limit               = 65535
table-definition-cache         = 4096
table-open-cache               = 4096
# INNODB #
query_cache_size               = 0
max_heap_table_size            = 96M
tmp_table_size                 = 96M
long_query_time                = 1
innodb-flush-method            = O_DIRECT
innodb-log-files-in-group      = 2
innodb-log-file-size           = 128M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table          = 1
innodb-buffer-pool-size        = 1G
innodb_write_io_threads        = 8
innodb_read_io_threads         = 8
innodb_purge_threads           = 4
innodb_buffer_pool_instances   = 3
innodb_stats_on_metadata       = OFF
join_buffer_size               = 262144
sort_buffer_size               = 262144
innodb_support_xa              = 1
default-storage-engine =innodb
innodb_io_capacity=1000
innodb_open_files = 500
innodb_doublewrite=0
innodb_file_format=Barracuda
innodb_thread_concurrency= 0
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
# LOGGING #
log-error                      = /home/mysql/dataUp/mysql-error.log
log-queries-not-using-indexes  = 1
slow-query-log                 = 1
slow-query-log-file            = /home/mysql/dataUp/mysql-slow.log
# REPLICATION #
slave_compressed_protocol      = on
sync_relay_log_info            = 10000
log-slave-updates              = 1
relay-log                      = /home/mysql/dataUp/relay-bin
relay_log_recovery             = 1
binlog_gtid_simple_recovery    = 1
slave-net-timeout              = 60
sync_master_info               = 1
sync-relay-log                 = 1
sync-relay-log-info            = 1
master_info_repository         = TABLE
relay_log_info_repository      = TABLE
slave_skip_errors              = ddl_exist_errors
binlog_checksum=NONE
replicate-ignore-db=information_schema
replicate-ignore-db=mysql
replicate-ignore-db=performance_schema
replicate-ignore-db=sys
replicate-ignore-db=dmm_170401
replicate-ignore-db=sqlauditbo
# semi sync replication settings #
plugin_dir                     = /usr/local/mysql/lib/plugin
plugin_load                    = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so"
rpl_semi_sync_master_enabled   = 1
rpl_semi_sync_slave_enabled    = 1
rpl_semi_sync_master_timeout   = 5000
# GTID #
gtid_mode                      = on
enforce_gtid_consistency       = on
# SLOW LOG #
slow_query_log=ON
#slow_query_log_file=/home/mysql/dataUp/SlaveSed-slow.log
long_query_time=5
####################### SLAVE PARAMETER #####################
#read_only=1
#super_read_only=1
####################### mysql 57 #####################
slave_parallel_type=LOGICAL_CLOCK
slave_parallel_workers=4
rpl_semi_sync_master_wait_point = after_sync
rpl_semi_sync_master_wait_for_slave_count = 1
########group replication##############
relay_log_info_repository=TABLE
master_info_repository=table
binlog_checksum=NONE
log_slave_updates=ON
binlog_format=ROW
gtid_mode=ON
transaction_write_set_extraction=XXHASH64
slave_parallel_type=LOGICAL_CLOCK
slave_preserve_commit_order=1
loose-group_replication_group_name = 'ce9be252-2b71-11e6-b8f4-00212889f851'
loose-group_replication_start_on_boot = off
loose-group_replication_bootstrap_group = off
loose-group_replication_local_address = '192.168.56.115:33071'
loose-group_replication_group_seeds ='192.168.56.117:33061,192.168.56.115:33061,192.168.56.115:33071'
loose-group_replication_single_primary_mode = off
loose-group_replication_enforce_update_everywhere_checks = on
group_replication_ssl_mode=REQUIRED


2、安装插件:
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
插件安装后确认:
mysql> show plugins;
+----------------------------+----------+--------------------+----------------------+-------------+
| Name                       | Status   | Type               | Library              | License     |
+----------------------------+----------+--------------------+----------------------+-------------+
| group_replication          | ACTIVE   | GROUP REPLICATION  | group_replication.so | PROPRIETARY |
+----------------------------+----------+--------------------+----------------------+-------------+

3、配置组复制
a、117-3306实例配置:
给用户赋权
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'SlaveSed' IDENTIFIED BY 'repl';

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'SlaveFri' IDENTIFIED BY 'repl';

配置复制使用组复制

CHANGE MASTER TO MASTER_USER='repl',MASTER_PASSWORD='repl' FOR CHANNEL 'group_replication_recovery';
设置ip白名单
set global group_replication_ip_whitelist="127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.56.0/16,192.168.1.0/24";
启动引导
set global group_replication_bootstrap_group=on;
是否是Group Replication的引导节点,初次搭建集群的时候需要有一个节点设置为ON来启动Group Replication
启动组复制

START GROUP_REPLICATION;

查看组复制是否成功

SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | a310fe2b-bafa-11e7-a77a-080027c4ed73 | SlaveSed    |        3306 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+

关闭引导

set global group_replication_bootstrap_group=off;


b、使用xtrabackup用117-3306数据库初始化115-3306和115-3307(略)


c、配置 group_replication_recovery 通道的恢复凭据

192.168.56.115 3306  && 192.168.56.115 3307:

给用户赋权
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'SlaveSed' IDENTIFIED BY 'repl';

GRANT REPLICATION SLAVE ON *.* TO 'repl'@'SlaveFri' IDENTIFIED BY 'repl';

配置复制使用组复制

mysql> CHANGE MASTER TO MASTER_USER='repl',MASTER_PASSWORD='repl' FOR CHANNEL 'group_replication_recovery';
配置IP白名单
mysql> set global group_replication_ip_whitelist="127.0.0.1/32,10.0.0.0/8,172.16.0.0/12,192.168.56.0/16,192.168.1.0/24";
配置当前实例允许加入复制组
set global group_replication_allow_local_disjoint_gtids_join=on;
启动复制
mysql> START GROUP_REPLICATION;
查看
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | a310fe2b-bafa-11e7-a77a-080027c4ed73 | SlaveSed    |        3306 | ONLINE       |
| group_replication_applier | a406693a-d26c-11e7-a557-0800277e40b1 | SlaveFri    |        3307 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
2 rows in set (0.00 sec)

4、复制测试
在117 3306、115 3306、115 3307分别建表并做插入测试
create database test;
use test;
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 varchar(20));
INSERT INTO t1 VALUES (1, 'lalala');
select * from test.t1;

5、组复制数据全局一致性测试

因为之前搭建过双主复制,但其无法保证数据的全局一致性,故在此对组复制也进行了测试

注意!在事务不自动提交的情况下做测试(set autocommit=0)

测试方式如下

1、117-3306修改t2表数据  ------------------------update t2 set c2='1111111111' where c1=2;

2、115-3306也修改该行数据并进行提交-------update t2 set c2='22222' where c1=2; commit;

3、当117-3306在对该行执行操作的时候,需要重新生成事务

ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction


6、模拟节点宕机验证

宕机前查询
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 166a23a8-d275-11e7-960b-0800277e40b1 | SlaveFri    |        3306 | ONLINE       |
| group_replication_applier | a310fe2b-bafa-11e7-a77a-080027c4ed73 | SlaveSed    |        3306 | ONLINE       |
| group_replication_applier | a406693a-d26c-11e7-a557-0800277e40b1 | SlaveFri    |        3307 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+

******************************************************************************************
******************************************宕掉117主机*************************************
******************************************************************************************

宕机后查询
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 166a23a8-d275-11e7-960b-0800277e40b1 | SlaveFri    |        3306 | ONLINE       |
| group_replication_applier | a406693a-d26c-11e7-a557-0800277e40b1 | SlaveFri    |        3307 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+

健康节点插入测试:
115-3306操作:
use test;
insert into t1 select 5,'111111111';
insert into t1 select 2,'111111111';
115-3307查询:
mysql> select * from test.t1;
+----+-----------+
| c1 | c2        |
+----+-----------+
|  1 | aaaaaaaaa |
|  2 | 111111111 |
|  5 | 111111111 |
+----+-----------+

重新启动117并配置加入集群
set global group_replication_start_on_boot=on;
show variables like '%group_replication_start_on_boot%';
set global group_replication_allow_local_disjoint_gtids_join=on;
show variables like '%group_replication_allow_local_disjoint_gtids_join%';
set global group_replication_ssl_mode=REQUIRED;
show variables like '%group_replication_ssl_mode%';
START GROUP_REPLICATION;
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID                            | MEMBER_HOST | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
| group_replication_applier | 166a23a8-d275-11e7-960b-0800277e40b1 | SlaveFri    |        3306 | ONLINE       |
| group_replication_applier | a310fe2b-bafa-11e7-a77a-080027c4ed73 | SlaveSed    |        3306 | ONLINE       |
| group_replication_applier | a406693a-d26c-11e7-a557-0800277e40b1 | SlaveFri    |        3307 | ONLINE       |
+---------------------------+--------------------------------------+-------------+-------------+--------------+
查询日志是否应用
mysql> select * from test.t1;
+----+-----------+
| c1 | c2        |
+----+-----------+
|  1 | aaaaaaaaa |
|  2 | 111111111 |
|  5 | 111111111 |

+----+-----------+


7、错误总结:

1、组复制-安装组复制插件报错
INSTALL PLUGIN group_replication SONAME 'group_replication.so';
错误日志:
2017-11-26T00:39:07.574723Z 4 [ERROR] For the creation of replication channels the master info and relay log info repositories must be set to TABLE
2017-11-26T00:39:07.574993Z 4 [ERROR] Plugin group_replication reported: 'Failure during Group Replication handler initialization'
解决办法:
relay_log_info_repository=TABLE
master_info_repository=table

2、组复制-写节点启动报错
错误日志:
2017-11-26T03:02:32.031724Z 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.56.115:33061 on local port: 33061. Error= 0'
2017-11-26T03:02:32.031791Z 0 [Note] Plugin group_replication reported: 'connecting to 192.168.56.115 33071'
2017-11-26T03:02:32.032132Z 0 [Note] Plugin group_replication reported: 'Getting the peer name failed while connecting to server 192.168.56.115 with error 111 -Connection refused.'
解决办法:
执行START GROUP_REPLICATION;前先执行set global group_replication_bootstrap_group=on;
或global group_replication_ssl_mode未设置
mysql> set global group_replication_ssl_mode=REQUIRED;

3、组复制-读节点启动报错
错误日志:
2017-11-26T03:15:30.953053Z 0 [ERROR] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: 148e4cf1-baed-11e7-a766-0800278cae5d:1-11,
82793680-d184-11e7-adcc-0800277e40b1:1-3,
a310fe2b-bafa-11e7-a77a-080027c4ed73:1-25451:25453,
cc690b69-bd1e-11e7-a149-0800277e40b1:1-11,
cf6cfed3-b7e2-11e7-b916-0800278cae5d:1-330 > Group transactions: a310fe2b-bafa-11e7-a77a-080027c4ed73:1-25455,
cc690b69-bd1e-11e7-a149-0800277e40b1:3-5,
ce9be252-2b71-11e6-b8f4-00212889f851:1-2'
2017-11-26T03:15:30.953475Z 0 [ERROR] Plugin group_replication reported: 'The member contains transactions not present in the group. The member will now exit the group.'
可以很明显看到日志中已经提示了,需要设置参数,也就是兼容加入组。group_replication_allow_local_disjoint_gtids_join设置完成后运行start group_replication即可。
在执行START GROUP_REPLICATION;前执行set global group_replication_allow_local_disjoint_gtids_join=on;

你可能感兴趣的:(MySQL)