Table of Contents
4, install " > 4, install

, configure group replicationparameters" >5
, configure
group replicationparameters
5.2配置文件配置" >5.2配置文件配置
6,启动mgr集群" >6,启动mgr集群
7,验证集群复制功能" >7,验证集群复制功能
8,问题记录" >8,问题记录
8.1问题记录一" >8.1问题记录一
8.2 问题记录二RECOVERING   " >8.2 问题记录二RECOVERING  
8.3问题记录三" >8.3问题记录三
Home Database Mysql Tutorial Detailed introduction to the construction and deployment process of MySQL Group Replication[Single-Primary Mode]

Detailed introduction to the construction and deployment process of MySQL Group Replication[Single-Primary Mode]

Mar 22, 2017 pm 01:46 PM

1, AboutMySQL Group Replication

Group-based Replication (Group-basedReplication) is a method used in fault-tolerant systems technology in. Replication-group is composed of multiple servers (nodes) that can communicate with each other.

In the communication layer, Groupreplication implements a series of mechanisms: such as atomic message delivery and total ordering of messages.

These atomic and abstract mechanisms provide strong support for implementing more advanced database replication solutions.

MySQL Group Replication implements a multi-master, fully updated replication protocol based on these technologies and concepts.

In short, a Replication-group is a group of nodes. Each node can execute transactions independently, and read and write transactions will be coordinated with other nodes in the group before committing.

Therefore, when a transaction is ready to be submitted, it will automatically be atomically broadcast within the group to inform other nodes of what content has been changed/what transactions have been performed.

This atomic broadcast method keeps this transaction in the same order on every node.

This means that each node receives the same transaction log in the same order, so each node replays these transaction logs in the same order, and ultimately the entire group maintains a completely consistent state.

However, there may be resource contention between transactions executed on different nodes. This phenomenon easily occurs in two different concurrent transactions.

Suppose there are two concurrent transactions on different nodes that update the same row of data, then resource contention will occur.

Faced with this situation, GroupReplication determines that the transaction submitted first is a valid transaction and will be repeated in the entire group. The transaction submitted later will be directly interrupted, or rolled back, and finally discarded.

Therefore, this is also a shared-nothing replication scheme, and each node saves a complete copy of the data. See the following picture 01.png, which describes the specific workflow and can be compared with other solutions concisely. This replication scheme is, to some extent, similar to the Replication method of the database state machine (DBSM).

2, install mysql5.7.17

Official download, but the official only keeps the latest version. The url address 5.7.17 may not be valid for a long time, so it may not be necessary. I have kept it on Baidu Cloud Disk. The version is 5.7.17. You can go there at any time. Download and use,


Set /etc/hosts mapping on the three db servers, as follows:


Installed database server:

192.168.121.71 db1                                                                                                                                                    .111 db2            

192.168.121.24   db3

##/data/mysql/dataSet hostname and ip mappingCreate a replication account on db1/db2/db3:
GRANT REPLICATION SLAVE ON *.* TO  'repl'@'192.168.%' IDENTIFIED BY 'rlpbright_1927@ys';
Copy after login
#Database server address                                                                                                 

Data Directory                                                                                                                   68.121.71(db1)

3317

##12001        

192.168.121.111(db2)

3317

/data/mysql/data

12002

##192.168.121.24 (db3)

3317

/data/mysql/data

##12003

##3
, create a replication environment

Set on db1, db2, and db3

vim /etc/hosts
192.168.121.71 db1 hch_test_dbm2_121_71                                                                                              
192.168.121.111 db2 bpe_service
192.168.121.24 db3 hch_test_web_1_24
Copy after login

4, install

group replication

plug-in

Install the group replication plug-in on db1, db2, and db3 in sequence
mysql> INSTALL PLUGIN group_replication SONAME 'group_replication.so';                        
Query OK, 0 rows affected (0.01 sec)
 
mysql>
Copy after login
plugin-load=group_replication or configure it directly in the configuration file View group replication component
mysql> show plugins;
+----------------------------+----------+--------------------+----------------------+---------+
| Name                       | Status   | Type               | Library              | License |
+----------------------------+----------+--------------------+----------------------+---------+
| binlog                     | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| mysql_native_password      | ACTIVE   | AUTHENTICATION     | NULL                 | GPL     |
| sha256_password            | ACTIVE   | AUTHENTICATION     | NULL                 | GPL     |
| MyISAM                     | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| PERFORMANCE_SCHEMA         | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| InnoDB                     | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| INNODB_TRX                 | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_LOCKS               | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_LOCK_WAITS          | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMP                 | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMP_RESET           | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMPMEM              | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMPMEM_RESET        | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMP_PER_INDEX       | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_BUFFER_PAGE         | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_BUFFER_PAGE_LRU     | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_BUFFER_POOL_STATS   | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_TEMP_TABLE_INFO     | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_METRICS             | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_DELETED          | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_BEING_DELETED    | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_CONFIG           | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_INDEX_CACHE      | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_FT_INDEX_TABLE      | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_SYS_TABLES          | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_SYS_TABLESTATS      | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_SYS_INDEXES         | ACTIVE   | INFORMATION SCHEMA | NULL              | GPL     |
| INNODB_SYS_COLUMNS         | ACTIVE   | INFORMATION SCHEMA | NULL               | GPL     |
| INNODB_SYS_FIELDS          | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_SYS_FOREIGN         | ACTIVE   | INFORMATION SCHEMA | NULL                | GPL     |
| INNODB_SYS_FOREIGN_COLS    | ACTIVE   | INFORMATION SCHEMA | NULL               | GPL     |
| INNODB_SYS_TABLESPACES     | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| INNODB_SYS_DATAFILES       | ACTIVE   | INFORMATION SCHEMA | NULL              | GPL     |
| INNODB_SYS_VIRTUAL         | ACTIVE   | INFORMATION SCHEMA | NULL                 | GPL     |
| MRG_MYISAM                 | ACTIVE   | STORAGE ENGINE     | NULL              | GPL     |
| MEMORY                     | ACTIVE   | STORAGE ENGINE     | NULL              | GPL     |
| CSV                        | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| BLACKHOLE                  | ACTIVE   | STORAGE ENGINE     | NULL               | GPL     |
| partition                  | ACTIVE   | STORAGE ENGINE     | NULL             | GPL     |
| FEDERATED                  | DISABLED | STORAGE ENGINE     | NULL            | GPL     |
| ARCHIVE                    | ACTIVE   | STORAGE ENGINE     | NULL                 | GPL     |
| ngram                      | ACTIVE   | FTPARSER      | NULL      | GPL     |
| group_replication          | ACTIVE   | GROUP REPLICATION  | group_replication.so | GPL     |
+----------------------------+----------+--------------------+----------------------+---------+
45 rows in set (0.00 sec)
 
mysql>
Copy after login
my.cnf:

5
, configure
group replicationparameters

Make sure

binlog_format

is

row

Format.

mysql> show variables like 'binlog_format';                                            
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| binlog_format | ROW   |
+---------------+-------+
1 row in set (0.00 sec)
 
mysql>
Copy after login
Two configuration methods, add OR configuration file online5.1Add online

Configuration:(1) The configuration commands are as follows, specific to a certain

db

The nodes will be adjusted, and most of the parameters are consistent:

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 =  "0c6d3e5f-90e2-11e6-802e-842b2b5909d6";                                                                                                                          
 set @@global.group_replication_local_address  = 'db1:6606';
 set @@global.group_replication_group_seeds =  'db2:6607,db3:6608';
Copy after login

(2)

Indb1
The execution process is as follows:

mysql> set  @@global.transaction_write_set_extraction = XXHASH64;
Query OK, 0 rows affected (0.00 sec)
 
mysql> set  @@global.group_replication_start_on_boot = OFF;
Query OK, 0 rows affected (0.00 sec)
 
mysql> set  @@global.group_replication_bootstrap_group = OFF;
Query OK, 0 rows affected (0.00 sec)
 
mysql>
mysql>set @@global.group_replication_group_name  = "0c6d3e5f-90e2-11e6-802e-842b2b5909d7";                             
Query OK, 0 rows affected (0.00 sec)
 
mysql> set  @@global.group_replication_local_address = 'db1:6606';
Query OK, 0 rows affected (0.00 sec)
 
mysql> set  @@global.group_replication_group_seeds = 'db2:6607,db3:6608';
Query OK, 0 rows affected (0.00 sec)
 
mysql>
Copy after login
(3)

at

The execution process of db2

is as follows:

mysql>   set @@global.transaction_write_set_extraction = XXHASH64;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_start_on_boot = OFF;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_bootstrap_group = OFF;
Query OK, 0 rows affected (0.01 sec)
 
mysql>   set @@global.group_replication_group_name =  "0c6d3e5f-90e2-11e6-802e-842b2b5909d6";
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set  @@global.group_replication_local_address = 'db2:6607';
Query OK, 0 rows affected (0.00 sec)
 
mysql>  set @@global.group_replication_group_seeds =  'db1:6606,db3:6608';
Query OK, 0 rows affected (0.01 sec)
 
mysql>
Copy after login
(4)

In

db3

The execution process is as follows:

mysql>   set @@global.transaction_write_set_extraction = XXHASH64 ;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_start_on_boot = OFF;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_bootstrap_group = OFF ;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_group_name =  "0c6d3e5f-90e2-11e6-802e-842b2b5909d6";
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set  @@global.group_replication_local_address = 'db3:6608'  ;
Query OK, 0 rows affected (0.00 sec)
 
mysql>   set @@global.group_replication_group_seeds  = 'db1:6606,db2:6607' ;
Query OK, 0 rows affected (0.00 sec)
 
mysql>
Copy after login

5.2配置文件配置

1 db1上的my.cnf配置:

server-id=12001
transaction_write_set_extraction =  XXHASH64
loose-group_replication_group_name =  "5f847ff2-d701-11e6-819c-b8ca3af6e36c"                                                                                                                                                      
loose-group_replication_start_on_boot =  off
loose-group_replication_local_address  = "db1:23306"
loose-group_replication_group_seeds =  "db1:23306,db2:23307,db3:23308"
loose-group_replication_bootstrap_group =  off
loose-group_replication_single_primary_mode  = true
loose-group_replication_enforce_update_everywhere_checks  = false
Copy after login

2db2上的my.cnf配置:

server-id=12002
transaction_write_set_extraction = XXHASH64
loose-group_replication_group_name =  "5f847ff2-d701-11e6-819c-b8ca3af6e36c"
loose-group_replication_start_on_boot =  off
loose-group_replication_local_address  = "db2:23307"
loose-group_replication_group_seeds =  "db1:23306,db2:23307,db3:23308"
loose-group_replication_bootstrap_group =  off
loose-group_replication_single_primary_mode  = true
loose-group_replication_enforce_update_everywhere_checks  = false
Copy after login

3db3上的my.cnf配置:

server-id=12003
transaction_write_set_extraction =  XXHASH64
loose-group_replication_group_name =  "5f847ff2-d701-11e6-819c-b8ca3af6e36c"
loose-group_replication_start_on_boot =  off
loose-group_replication_local_address  = "db3:23308"
loose-group_replication_group_seeds =  "db1:23306,db2:23307,db3:23308"
loose-group_replication_bootstrap_group =  off
loose-group_replication_single_primary_mode  = true
loose-group_replication_enforce_update_everywhere_checks  = false
Copy after login

配置完后,重启3个db上的mysql服务,本次案例,我们选择5.2 配置文件配置方式实现。

6,启动mgr集群

开始构建group replication集群,通常操作命令

mysql>  CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='rlpbright_1927@ys' FOR CHANNEL 'group_replication_recovery';
Query OK, 0 rows affected, 2 warnings (0.02 sec)
 
mysql>
Copy after login

Db1上建立基本主库master库:

# 设置group_replication_bootstrap_group为ON是为了标示以后加入集群的服务器以这台服务器为基准,以后加入的就不需要设置。
mysql> SET GLOBAL group_replication_bootstrap_group = ON;
Query OK, 0 rows affected (0.00 sec)
 
mysql>  START GROUP_REPLICATION;
Query OK, 0 rows affected (1.03 sec)
 
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME         | MEMBER_ID  | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |   3317 | ONLINE  |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
1 row in set (0.00 sec)
 
mysql>
Copy after login

Db2上启动group_replication:

Db2上mysql命令行上执行启动:
mysql>  START GROUP_REPLICATION;
Query OK, 0 rows affected (1.02 sec)
 
mysql>
 
db1上后台error log显示:
2017-01-10T07:37:39.946919Z 0 [Note] Plugin group_replication reported: 'getstart group_id 41e28b21'
2017-01-10T07:58:47.624090Z 0 [Note] Plugin group_replication reported: 'getstart group_id 41e28b21'
2017-01-10T07:58:53.116957Z 0 [Note] Plugin group_replication reported: 'Marking group replication view change with view_id 14840330835325176:6'
 
再去master库db1上,查看group_replication成员,会有db2的显示
mysql>  SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID   | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | fdf2b02e-d66f-11e6-98a8-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
2 rows in set (0.00 sec)
 
mysql>
Copy after login

Db3上启动group_replication:

-- Db3命令行上执行:
mysql> set global group_replication_allow_local_disjoint_gtids_join=ON;
Query OK, 0 rows affected (0.00 sec)
 
mysql> start group_replication;
Query OK, 0 rows affected (1.99 sec)
 
mysql>
 
-- 再去master库db1上,查看group_replication成员,会有db3的显示,而且已经是ONLINE了
mysql>  SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID    | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | ef8ac2de-d671-11e6-9ba4-18a99b763071 | hch_test_web_1_24    |        3317 | ONLINE       |
| group_replication_applier | fdf2b02e-d66f-11e6-98a8-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.01 sec)
 
mysql>
 
-- db1上后台error log显示:
2017-01-10T08:00:28.866356Z 0 [Note] Plugin group_replication reported: 'getstart group_id 41e28b21'
2017-01-10T08:00:54.699130Z 0 [Note] Plugin group_replication reported: 'getstart group_id 41e28b21'
2017-01-10T08:00:56.567427Z 0 [Note] Plugin group_replication reported: 'Marking group replication view change with view_id 14840330835325176:9'
Copy after login

最后查看集群状态,都为ONLINE就表示OK:

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID   | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | ef8ac2de-d671-11e6-9ba4-18a99b763071 | hch_test_web_1_24    |        3317 | ONLINE       |
| group_replication_applier | fdf2b02e-d66f-11e6-98a8-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.00 sec)
 
mysql>
Copy after login

7,验证集群复制功能

测试,在master库db1上建立测试库db1,测试表t1,录入一条数据

mysql> create database db1;
Query OK, 1 row affected (0.00 sec)
 
mysql> create table db1.t1(id int,cnvarchar(32));
Query OK, 0 rows affected (0.02 sec)
 
mysql>
mysql> insert into t1 select 1,'a';
ERROR 3098 (HY000): The table does notcomply with the requirements by an external plugin.
mysql>
mysql> insert into t1(id,cn)values(1,'a');
ERROR 3098 (HY000): The table does notcomply with the requirements by an external plugin.
mysql>
mysql>
-- # 这里原因是group_replaction环境下面,表必须有主键不然不允许往里insert值。所以修改表t1,将id字段设置程主键即可。
mysql> alter table t1 modify id intprimary key;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0  Warnings: 0
 
mysql> insert into t1 select 1,'a';
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0  Warnings: 0
 
mysql>
Copy after login

去db2/db3上可以看到数据已经同步过去

mysql> select * from db1.t1;
+----+------+
| id | cn  |
+----+------+
|  1| a    |
+----+------+
1 row in set (0.00 sec)
 
mysql>
Copy after login

然后在db2/db3上执行inert操作,则拒绝,因为db2、db3为readonly

mysql> insert into t1 select 2,'b';
ERROR 1290 (HY000): The MySQL server isrunning with the --super-read-only option so it cannot execute this statement
mysql>
Copy after login

8,问题记录

8.1问题记录一

MySQL窗口报错:

ERROR 3092 (HY000): The server is notconfigured properly to be an active member of the group. Please see moredetails on error log.
后台ERROR LOG报错:
[ERROR] Plugin group_replication reported:'This member has more executed transactions than those present in the group.
Local transactions: f16f7f74-c283-11e6-ae37-fa163ee40410:1 > Grouptransactions: 3c992270-c282-11e6-93bf-fa163ee40410:1,
 aaaaaa:1-5'
 [ERROR]Plugin group_replication reported: 'The member contains transactions notpresent in the group. The member will now exit the group.'
 [Note] Plugin group_replication reported: 'Toforce this member into the group you can use the group_replication_allow_local_disjoint_gtids_joinoption'
Copy after login

【解决办法】:

根据提示打开group_replication_allow_local_disjoint_gtids_join选项,mysql命令行执行:

mysql> set globalgroup_replication_allow_local_disjoint_gtids_join=ON;
Copy after login

再执行开启组复制:

mysql> start group_replication;
Query OK, 0 rows affected (7.89 sec)
 
mysql>
Copy after login

8.2 问题记录二RECOVERING

在db1上查询集群组成员

mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME     | MEMBER_ID     | MEMBER_HOST     | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |       3317 | ONLINE       |
| group_replication_applier | ef8ac2de-d671-11e6-9ba4-18a99b763071 | hch_test_web_1_24    |       3317 | RECOVERING   |
| group_replication_applier | fdf2b02e-d66f-11e6-98a8-18a99b76310d | bpe_service        |    3317 | RECOVERING   |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.00 sec)
 
mysql>
Copy after login

再查看后台error日志,

2017-01-10T09:17:39.449488Z 146 [ERROR] Slave I/O for channel 'group_replication_recovery': 
error connecting to master 'repl@hch_test_dbm2_121_71:3317' - retry-time: 60  retries: 1, Error_code: 2003
2017-01-10T09:17:39.450289Z 146 [Note] Slave I/O thread for channel 'group_replication_recovery' killed while connecting to master
2017-01-10T09:17:39.450449Z 146 [Note] Slave I/O thread exiting for channel 'group_replication_recovery', read up to log 'FIRST', position 4
2017-01-10T09:17:39.451579Z 144 [ERROR] Plugin group_replication reported: 'There was an error when connecting to the donor server. 
Check group replication recovery's connection credentials.'
2017-01-10T09:17:39.452341Z 144 [Note] Plugin group_replication reported: 'Retrying group recovery connection with another donor. Attempt 2/10'
2017-01-10T09:17:39.457834Z 0 [Note] Plugin group_replication reported: 'Marking group replication view change with view_id 14840330835325176:25'
2017-01-10T09:18:39.456629Z 144 [Note] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_recovery' executed'. 
Previous state master_host='hch_test_dbm2_121_71', master_port= 3317, master_log_file='', master_log_pos= 4, master_bind=''. 
New state master_host='hch_test_dbm2_121_71', master_port= 3317, master_log_file='', master_log_pos= 4, master_bind=''.
2017-01-10T09:18:39.485250Z 144 [Note] Plugin group_replication reported: 'Establishing 
connection to a group replication recovery donor 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c at hch_test_dbm2_121_71 port: 3317.'
2017-01-10T09:18:39.489356Z 150 [Warning] Storing MySQL user name or 
password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and 
PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
2017-01-10T09:18:39.493511Z 150 [ERROR] Slave I/O for channel 'group_replication_recovery': 
error connecting to master 'repl@hch_test_dbm2_121_71:3317' - retry-time: 60  retries: 1, Error_code: 2005
2017-01-10T09:18:39.493912Z 150 [Note] Slave I/O thread for channel 'group_replication_recovery' killed while connecting to master
2017-01-10T09:18:39.494069Z 150 [Note] Slave I/O thread exiting for channel 'group_replication_recovery', read up to log 'FIRST', position 4
2017-01-10T09:18:39.495155Z 144 [ERROR] Plugin group_replication reported: 
'There was an error when connecting to the donor server. Check group replication recovery's connection credentials.'
2017-01-10T09:18:39.496838Z 144 [Note] Plugin group_replication reported: 'Retrying group recovery connection with another donor. Attempt 3/10'
Copy after login

【解决办法】:

看报错[ERROR] Slave I/O for channel'group_replication_recovery': error connecting to master 'repl@hch_test_dbm2_121_71:3317'- retry-time: 60 retries: 1, Error_code:2005,连接master库不上,所以问题在这里,我们赋予的复制账号是iprepl@'192.168.%',所以还需要做一个hostname(hch_test_dbm2_121_71)db1ip地址192.168.121.71的映射关系。

建立hostname和ip映射

vim /etc/hosts
192.168.121.71 db1 hch_test_dbm2_121_71                                          
192.168.121.111 db2 bpe_service
192.168.121.24 db3 hch_test_web_1_24
Copy after login

然后在db2上执行如下命令后重新开启group_replication即可。

mysql> stop group_replication;
Query OK, 0 rows affected (0.02 sec)                                                 
 
mysql> start group_replication;
Query OK, 0 rows affected (5.68 sec)
 
mysql>
Copy after login

再去master库db1上,查看group_replication成员,会有db2的显示

mysql>  SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME   | MEMBER_ID     | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3d872c2e-d670-11e6-ac1f-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | fdf2b02e-d66f-11e6-98a8-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
2 rows in set (0.00 sec)
 
mysql>
Copy after login

8.3问题记录三

操作问题

mysql>
mysql> START GROUP_REPLICATION;
ERROR 3092 (HY000): The server is notconfigured properly to be an active member of the group. Please see moredetails on error log.
Copy after login

【解决办法】:

mysql> SET GLOBALgroup_replication_bootstrap_group = ON;
Query OK, 0 rows affected (0.00 sec)
 
mysql> START GROUP_REPLICATION;
Query OK, 0 rows affected (1.03 sec)
 
mysql>
Copy after login

The above is the detailed content of Detailed introduction to the construction and deployment process of MySQL Group Replication[Single-Primary Mode]. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

MySQL: The Ease of Data Management for Beginners MySQL: The Ease of Data Management for Beginners Apr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

How to open phpmyadmin How to open phpmyadmin Apr 10, 2025 pm 10:51 PM

You can open phpMyAdmin through the following steps: 1. Log in to the website control panel; 2. Find and click the phpMyAdmin icon; 3. Enter MySQL credentials; 4. Click "Login".

How to create navicat premium How to create navicat premium Apr 09, 2025 am 07:09 AM

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

MySQL and SQL: Essential Skills for Developers MySQL and SQL: Essential Skills for Developers Apr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

How to create a new connection to mysql in navicat How to create a new connection to mysql in navicat Apr 09, 2025 am 07:21 AM

You can create a new MySQL connection in Navicat by following the steps: Open the application and select New Connection (Ctrl N). Select "MySQL" as the connection type. Enter the hostname/IP address, port, username, and password. (Optional) Configure advanced options. Save the connection and enter the connection name.

How to recover data after SQL deletes rows How to recover data after SQL deletes rows Apr 09, 2025 pm 12:21 PM

Recovering deleted rows directly from the database is usually impossible unless there is a backup or transaction rollback mechanism. Key point: Transaction rollback: Execute ROLLBACK before the transaction is committed to recover data. Backup: Regular backup of the database can be used to quickly restore data. Database snapshot: You can create a read-only copy of the database and restore the data after the data is deleted accidentally. Use DELETE statement with caution: Check the conditions carefully to avoid accidentally deleting data. Use the WHERE clause: explicitly specify the data to be deleted. Use the test environment: Test before performing a DELETE operation.

How to use single threaded redis How to use single threaded redis Apr 10, 2025 pm 07:12 PM

Redis uses a single threaded architecture to provide high performance, simplicity, and consistency. It utilizes I/O multiplexing, event loops, non-blocking I/O, and shared memory to improve concurrency, but with limitations of concurrency limitations, single point of failure, and unsuitable for write-intensive workloads.

See all articles