MySQL 그룹 복제 [다중 기본 모드]의 구성 및 배포 프로세스에 대한 자세한 소개(그림 및 텍스트)

黄舟
풀어 주다: 2017-03-22 13:37:23
원래의
2973명이 탐색했습니다.

1, 정보MySQL 그룹 복제

그룹 기반 복제는 오류에 사용되는 A 기술입니다. 관용 시스템. 복제 그룹은 서로 통신할 수 있는 여러 개의 서버(노드)로 구성됩니다.

통신 계층에서 그룹 복제는 원자성 메시지 전달 및 메시지 전체 순서 지정과 같은 일련의 메커니즘을 구현합니다. 이러한 원자적이고 추상적인 메커니즘은 고급 데이터베이스 복제 솔루션 구현을 위한 강력한 지원을 제공합니다.

MySQL 그룹 복제는 이러한 기술과 개념을 기반으로 완전히 업데이트된 다중 마스터 복제 프로토콜을 구현합니다.

간단히 말하면 복제 그룹은 노드 그룹입니다. 각 노드는 독립적으로 트랜잭션을 실행할 수 있으며 트랜잭션 읽기 및 쓰기는 커밋하기 전에 그룹 내 다른 노드와 조정됩니다.

따라서 트랜잭션을 제출할 준비가 되면 그룹 내에서 자동으로 자동으로 방송되어 어떤 내용이 변경되었는지/어떤 트랜잭션이 수행되었는지 다른 노드에 알립니다.

이 원자 브로드캐스트 방법은 모든 노드에서 이 트랜잭션을 동일한 순서로 유지합니다.

즉, 각 노드는 동일한 트랜잭션 로그를 동일한 순서로 수신하므로 각 노드는 이러한 트랜잭션 로그를 동일한 순서로 재생하며 궁극적으로 전체 그룹은 상태 완전히 일관되게 유지됩니다.

그러나 서로 다른 노드에서 실행되는 트랜잭션 간에 리소스 경합이 있을 수 있습니다. 이 현상은 두 개의 서로 다른 동시 트랜잭션에서 쉽게 발생합니다.

동일한 데이터 행을 업데이트하는 두 개의 동시 트랜잭션이 서로 다른 노드에 있다고 가정하면 리소스 경합이 발생합니다.

이러한 상황에 직면한 GroupReplication은 먼저 제출된 트랜잭션이 유효한 트랜잭션이라고 판단하고 나중에 제출된 트랜잭션이 직접 중단되거나 롤백된 후 최종적으로 폐기됩니다.

따라서 이 역시 비공유 복제 방식이며 각 노드는 데이터의 전체 복사본을 저장합니다. 특정 작업 흐름을 설명하고 다른 솔루션과 간결하게 비교할 수 있는 다음 그림 01.png를 참조하세요. 이 복제 방식은 DBSM(데이터베이스 상태 머신)의 복제 방법과 어느 정도 유사합니다.

2, 설치 mysql 5.7.17

공식 다운로드는 최신 버전만 유지하고 있습니다. URL 주소 5.7.17은 오랫동안 유효하지 않을 수 있으므로 여기 Baidu Cloud Disk에 보관해 두었습니다. 버전은 5.7.17이며 언제든지 다운로드하여 사용할 수 있습니다.

다음과 같이 3개의 db 서버에 /etc/hosts 매핑을 설정합니다.

192.168.121.71    db1                                                                                                            
192.168.121.111    db2
192.168.121.24    db3
로그인 후 복사

설치됨 데이터베이스 서버:

< td valign="top">데이터 디렉터리< /tr>< td valign="top"><🎜>/data/mysql/data <🎜>< td valign="top"><🎜>192.168.121.24 (db3) <🎜>

数据库服务器地址

端口

数据目录

Server-id

192.168.121.71(db1)

3317

/data/mysql/data

12001

192.168.121.111(db2)

3317

/data/mysql/data

12002

192.168.121.24(db3)

3317

/data/mysql/data

12003

데이터베이스 서버 주소    

포트
서버 ID

192.168.121.71 (db1)

3317

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
로그인 후 복사
/data/mysql/data<🎜>
<🎜>12001 <🎜>
<🎜 >192.168.121.111 (db2)<🎜><🎜>3317<🎜><🎜>12002<🎜>
<🎜>3317<🎜> <🎜>/data/mysql/data<🎜> <🎜>12003<🎜>
<🎜><🎜>< 🎜>3<🎜><🎜>, 복제 환경 생성<🎜><🎜><🎜>호스트 이름 및 IP 매핑 설정<🎜><🎜> db1, db2, db3에 설정<🎜><🎜>


在db1/db2/db3上建立复制账号:

mysql> SET SQL_LOG_BIN=0;
Query OK, 0 rows affected (0.00 sec)
 
mysql>
mysql> GRANT REPLICATION SLAVE ON *.*  TO &#39;repl&#39;@&#39;192.168.%&#39; IDENTIFIED BY &#39;rlpbright_1927@ys&#39;;
Query OK, 0 rows affected, 1 warning  (0.00 sec)
 
mysql>  
mysql> SET SQL_LOG_BIN=1;
Query OK, 0 rows affected (0.00 sec)
 
mysql>
로그인 후 복사

4,安装group replication插件

在db1、db2、db3上依次安装group replication插件

mysql> INSTALL PLUGIN group_replication  SONAME &#39;group_replication.so&#39;;                         
Query OK, 0 rows affected (0.01 sec)
 
mysql>
로그인 후 복사

plugin-load=group_replication或者直接在配置文件my.cnf中配置:

查看group replication组件

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>
로그인 후 복사


看到有group_replication ACTIVE,表示插group_replication插件安装成功。

5,配置group replication参数

确保binlog_formatrow格式。

mysql> show variables like &#39;binlog_format&#39;;                                             
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| binlog_format | ROW   |
+---------------+-------+
1 row in set (0.00 sec)
 
mysql>
로그인 후 복사

两种配置方式,在线添加 OR 配置文件

(1) db1上的my.cnf配置:
# replication config
server_id=12001
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
 
# group replication config
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="e4668cea-d7ca-11e6-86b5-18a99b76310d"                        
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "db1:24901"
loose-group_replication_group_seeds=  "db1:24901,db2:24902,db3:24903"
loose-group_replication_bootstrap_group=  off
loose-group_replication_single_primary_mode=FALSE
loose-group_replication_enforce_update_everywhere_checks=  TRUE
 
(2)db2上的my.cnf配置:
# replication config
server_id=12002
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
 
# group replication config
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="e4668cea-d7ca-11e6-86b5-18a99b76310d"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "db2:24902"
loose-group_replication_group_seeds=  "db1:24901,db2:24902,db3:24903"
loose-group_replication_bootstrap_group=  off
loose-group_replication_single_primary_mode=FALSE
loose-group_replication_enforce_update_everywhere_checks=  TRUE
 
 
(3)db3上的my.cnf配置:
# replication config
server_id=12003
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
 
# group replication config
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="e4668cea-d7ca-11e6-86b5-18a99b76310d"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "db3:24903"
loose-group_replication_group_seeds=  "db1:24901,db2:24902,db3:24903"
loose-group_replication_bootstrap_group=  off
loose-group_replication_single_primary_mode=FALSE
loose-group_replication_enforce_update_everywhere_checks=  TRUE
로그인 후 복사

配置完后,重启3个db上的mysql服务

Db1启动:

[root@hch_test_dbm2_121_71 ~]# service  mysqld start                                     
Starting MySQL..                                           [确定]
[root@hch_test_dbm2_121_71 ~]#
로그인 후 복사

Db2启动:

[root@bpe_service ~]# service mysqld  start
Starting MySQL..                                           [确定]                                                     
[root@bpe_service ~]#
로그인 후 복사


Db3启动:

[root@hch_test_web_1_24 ~]# service  mysqld start                                            
Starting MySQL..                                           [确定]
[root@hch_test_web_1_24 ~]#
로그인 후 복사

6,启动mgr集群

构建之前,保证db1、db2、db3的read_only是关闭的

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

mysql>   CHANGE MASTER TO MASTER_USER=&#39;repl&#39;,  MASTER_PASSWORD=&#39;rlpbright_1927@ys&#39; FOR CHANNEL &#39;group_replication_recovery&#39;;
Query OK, 0 rows affected, 2 warnings  (0.02 sec)
 
mysql>
로그인 후 복사

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> SET GLOBAL group_replication_bootstrap_group=OFF;
Query OK, 0 rows affected (0.00 sec)
 
mysql>
mysql>  SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID    | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3381d155-d7d1-11e6-94f7-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE      |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
1 row in set (0.00 sec)
 
mysql>
로그인 후 복사

Db2上启动group_replication:

Db2上mysql命令行上执行启动:

mysql>   START GROUP_REPLICATION;
Query OK, 0 rows affected (1.02 sec)
 
mysql>
로그인 후 복사

db1后台error log日志显示,看到db2加入进来了,进了group:

2017-01-11T07:51:40.623093Z 0 [Note]  Plugin group_replication reported: &#39;Marking group replication view change  with view_id 14841207424144277:8&#39;
2017-01-11T07:51:40.650962Z 21 [Note]  Start binlog_dump to master_thread_id(21) slave_server(12002), pos(, 4)
2017-01-11T07:51:40.687441Z 0 [Note]  Plugin group_replication reported: &#39;The member with address bpe_service:3317  was 
declared online within the replication group&#39;
2017-01-11T07:52:40.651481Z 21 [Note]  Aborted connection 21 to db: &#39;unconnected&#39; user: &#39;repl&#39; host:  &#39;192.168.121.111&#39; (failed on flush_net())
로그인 후 복사

再去master库db1上,查看group_replication成员,会有db2的显示,看到MEMBER_STATE都是ONLINE,表示都是MASTER:

mysql>  SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID       | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 3381d155-d7d1-11e6-94f7-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | 84dba8ff-d7d2-11e6-aa9a-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
2 rows in set (0.00 sec)
 
mysql>
로그인 후 복사


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 | 21750571-d7d3-11e6-91e2-18a99b763071 | hch_test_web_1_24    |        3317 | ONLINE       |
| group_replication_applier | 3381d155-d7d1-11e6-94f7-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | 84dba8ff-d7d2-11e6-aa9a-18a99b76310d | bpe_service          |        3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.00 sec)
 
mysql>
로그인 후 복사

db1上后台error log显示:

2017-01-11T08:13:05.972276Z 0 [Note]  Plugin group_replication reported: &#39;getstart group_id 8da193f6&#39;
2017-01-11T08:13:08.146144Z 0 [Note]  Plugin group_replication reported: &#39;Marking group replication view change  with view_id 14841207424144277:11&#39;
2017-01-11T08:13:08.174808Z 25 [Note]  Start binlog_dump to master_thread_id(25) slave_server(12003), pos(, 4)
2017-01-11T08:13:08.218338Z 0 [Note]  Plugin group_replication reported: &#39;The member with address  
hch_test_web_1_24:3317 was declared online within the replication group&#39;
2017-01-11T08:14:08.175308Z 25 [Note]  Aborted connection 25 to db: &#39;unconnected&#39; user: &#39;repl&#39; host:  &#39;192.168.121.24&#39; (failed on flush_net())
로그인 후 복사

最后查看集群状态:

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>
로그인 후 복사

7,验证集群复制功能

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

mysql> create database db1;
Query OK, 1 row affected (0.00 sec)
 
mysql> create table db1.t1(id int,cn  varchar(32));
Query OK, 0 rows affected (0.02 sec)
 
mysql>
mysql> insert into t1(id,cn)values(  1,&#39;a&#39;);
ERROR 3098 (HY000): The table does not  comply with the requirements by an external plugin.
mysql>
mysql>
# 这里原因是group_replaction环境下面,表必须有主键不然不允许往里insert值。所以修改表t1,将id字段设置程主键即可。
mysql> alter table t1 modify id int  primary key;
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0
로그인 후 복사

然后在db2上执行insert操作,则成功

然后再db3上执行insert操作,则成功

在db1、db2、db3分部录入的数据,再分表去db1、db2、db3上查看t1表的数据,数据都已经复制同步过来了,已经实现了group里面多成员member多处写操作。

8 添加新的成员

简要步骤:

(1) 安装mysql实例

(2) 准备my.cnf

#replication
server_id=12001 # 这个是随着新服务器的添加会变化
gtid_mode=ON
enforce_gtid_consistency=ON
master_info_repository=TABLE
relay_log_info_repository=TABLE
binlog_checksum=NONE
log_slave_updates=ON
log_bin=binlog
binlog_format=ROW
 
#group replication
transaction_write_set_extraction=XXHASH64
loose-group_replication_group_name="e4668cea-d7ca-11e6-86b5-18a99b76310d"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address=  "db1:24901" # 这个是随着新服务器的添加会变化
loose-group_replication_group_seeds=  "db1:24901,db2:24902,db3:24903"# 这个是随着新服务器的添加会变化
loose-group_replication_bootstrap_group=  off
loose-group_replication_single_primary_mode=FALSE
loose-group_replication_enforce_update_everywhere_checks=  TRUE
로그인 후 복사

(3) 启动mysql实例,service mysqld start;

(4) 开启group replication

SET SQL_LOG_BIN=0;  # 在建立复制账号的时候,不需要进入binlog日志
GRANT REPLICATION SLAVE ON *.* TO &#39;repl&#39;@&#39;192.168.%&#39; IDENTIFIED BY  &#39;rlpbright_1927@ys&#39;;
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER=&#39;repl&#39;,  MASTER_PASSWORD=&#39;rlpbright_1927@ys&#39; FOR CHANNEL &#39;group_replication_recovery&#39;;
START group_replication;
SELECT * FROM performance_schema.replication_group_members;
로그인 후 복사


(5)验证组成员,SELECT * FROM performance_schema.replication_group_members;

9,管理操作命令

查看group状态信息:SELECT * FROM performance_schema.replication_group_members;

查询replication协议的其它数据:select * from performance_schema.replication_group_member_stats\G

查看后台进程2个:

[root@hch_test_dbm2_121_71 soft]# netstat  -ntpl|grep mysql
tcp         0      0 0.0.0.0:24901    0.0.0.0:*  LISTEN      3665/mysqld        
tcp         0      0 :::3317       :::*  LISTEN      3665/mysqld        
[root@hch_test_dbm2_121_71 soft]#
로그인 후 복사


组复制成员状态表:select * from performance_schema.replication_group_member_stats;查看的是当前的状态:

performance_schema.replication_applier_status


10,问题记录

10.1问题记录一

Db2的mysql窗口报错:
mysql> START GROUP_REPLICATION;
ERROR 3092 (HY000): The server is not  configured properly to be an active member of the group. Please see more  details on error log.
mysql>
 
db2的error log信息如下:
2017-01-11T07:57:41.161360Z 0 [ERROR]  Plugin group_replication reported: &#39;This member has more executed  
transactions than those present in the group. Local transactions:  84dba8ff-d7d2-11e6-aa9a-18a99b76310d:1 > 
Group transactions:  3381d155-d7d1-11e6-94f7-b8ca3af6e36c:1,
e4668cea-d7ca-11e6-86b5-18a99b76310d:1-3&#39;
2017-01-11T07:57:41.161430Z 0 [ERROR]  Plugin group_replication reported: &#39;The member contains transactions not  
present in the group. The member will now exit the group.&#39;
2017-01-11T07:57:41.161445Z 0 [Note]  Plugin group_replication reported: &#39;To force this member into the group you  
can use the group_replication_allow_local_disjoint_gtids_join option&#39;
2017-01-11T07:57:41.161589Z 3 [Note]  Plugin group_replication reported: &#39;Going to wait for view modification&#39;
2017-01-11T07:57:41.162126Z 0 [Note]  Plugin group_replication reported: &#39;getstart group_id 8da193f6&#39;
2017-01-11T07:57:44.508236Z 0 [Note]  Plugin group_replication reported: &#39;state 4330 action xa_terminate&#39;
2017-01-11T07:57:44.508429Z 0 [Note]  Plugin group_replication reported: &#39;new state x_start&#39;
2017-01-11T07:57:44.508561Z 0 [Note]  Plugin group_replication reported: &#39;state 4257 action xa_exit&#39;
2017-01-11T07:57:44.508720Z 0 [Note]  Plugin group_replication reported: &#39;Exiting xcom thread&#39;
2017-01-11T07:57:44.508746Z 0 [Note]  Plugin group_replication reported: &#39;new state x_start&#39;
2017-01-11T07:57:49.549137Z 3 [Note]  Plugin group_replication reported: &#39;auto_increment_increment is reset to 1&#39;
2017-01-11T07:57:49.549192Z 3 [Note]  Plugin group_replication reported: &#39;auto_increment_offset is reset to 1&#39;
2017-01-11T07:57:49.549472Z 23 [Note]  Error reading relay log event for channel &#39;group_replication_applier&#39;: 
slave  SQL thread was killed
2017-01-11T07:57:49.550037Z 20 [Note] Plugin  group_replication reported: &#39;The group replication applier thread was killed&#39;
 
【解决办法】设置group_replication_allow_local_disjoint_gtids_join为ON
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 (5.52 sec)
 
mysql>
로그인 후 복사

10.2问题记录二

Sql界面显示状态为ERROR:

Errorlog显示:

2017-01-11T08:07:34.587378Z 12 [Note]  &#39;CHANGE MASTER TO FOR CHANNEL &#39;group_replication_recovery&#39; executed&#39;.  
Previous state master_host=&#39;bpe_service&#39;, master_port= 3317,  master_log_file=&#39;&#39;, master_log_pos= 4, master_bind=&#39;&#39;. New state  
master_host=&#39;<NULL>&#39;, master_port= 0, master_log_file=&#39;&#39;,  master_log_pos= 4, master_bind=&#39;&#39;.
2017-01-11T08:07:34.591679Z 12 [ERROR]  Plugin group_replication reported: &#39;Fatal error during the Recovery process  of Group Replication. 
The server will leave the group.&#39;
2017-01-11T08:07:34.592447Z 0 [Note]  Plugin group_replication reported: &#39;getstart group_id 8da193f6&#39;
2017-01-11T08:07:37.943536Z 0 [Note]  Plugin group_replication reported: &#39;state 4330 action xa_terminate&#39;
2017-01-11T08:07:37.943852Z 0 [Note]  Plugin group_replication reported: &#39;new state x_start&#39;
2017-01-11T08:07:37.943879Z 0 [Note]  Plugin group_replication reported: &#39;state 4257 action xa_exit&#39;
2017-01-11T08:07:37.943981Z 0 [Note]  Plugin group_replication reported: &#39;Exiting xcom thread&#39;
2017-01-11T08:07:37.943999Z 0 [Note]  Plugin group_replication reported: &#39;new state x_start&#39;
로그인 후 복사

【解决办法】:

mysql> CHANGE MASTER TO MASTER_USER=&#39;repl&#39;, MASTER_PASSWORD=&#39;rlpbright_1927@ys&#39; FOR CHANNEL &#39;group_replication_recovery&#39;;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
 
mysql> stop group_replication;
Query OK, 0 rows affected (0.01 sec)
 
mysql> start group_replication;
Query OK, 0 rows affected (2.20 sec)
 
mysql>
mysql> SELECT * FROM performance_schema.replication_group_members;
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| CHANNEL_NAME              | MEMBER_ID      | MEMBER_HOST          | MEMBER_PORT | MEMBER_STATE |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
| group_replication_applier | 21750571-d7d3-11e6-91e2-18a99b763071 | hch_test_web_1_24    |    3317 | ONLINE       |
| group_replication_applier | 3381d155-d7d1-11e6-94f7-b8ca3af6e36c | hch_test_dbm2_121_71 |        3317 | ONLINE       |
| group_replication_applier | 84dba8ff-d7d2-11e6-aa9a-18a99b76310d | bpe_service     |     3317 | ONLINE       |
+---------------------------+--------------------------------------+----------------------+-------------+--------------+
3 rows in set (0.00 sec)
 
mysql>
로그인 후 복사

 

 

 

 

 

위 내용은 MySQL 그룹 복제 [다중 기본 모드]의 구성 및 배포 프로세스에 대한 자세한 소개(그림 및 텍스트)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿