Mysql组复制无法添加实例

Posted

技术标签:

【中文标题】Mysql组复制无法添加实例【英文标题】:Mysql group replication can't add instance 【发布时间】:2018-08-31 14:20:49 【问题描述】:

22.22.22.22 上的配置文件:

...

loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:33061"
loose-group_replication_group_seeds= "127.0.0.1:33061,33.33.33.33:33061"
loose-group_replication_bootstrap_group=off

我按照文档说的做了:

SET SQL_LOG_BIN=0;
CREATE USER rpl_user@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
FLUSH PRIVILEGES
SET SQL_LOG_BIN=1
CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';

INSTALL PLUGIN group_replication SONAME 'group_replication.so';

SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group=OFF;

到目前为止一切正常...

我在 33.33.33.33 上有一个配置文件:

...

loose-group_replication_group_name="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
loose-group_replication_start_on_boot=off
loose-group_replication_local_address= "127.0.0.1:33061"
loose-group_replication_group_seeds= "22.22.22.22:33061,127.0.0.1:33061"
loose-group_replication_bootstrap_group=off

我也关注文档:

SET SQL_LOG_BIN=0;
CREATE USER rpl_user@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
SET SQL_LOG_BIN=1;
CHANGE MASTER TO MASTER_USER='rpl_user', MASTER_PASSWORD='password' FOR CHANNEL 'group_replication_recovery';

INSTALL PLUGIN group_replication SONAME 'group_replication.so';

一切都还好..

但是当我进入时

START GROUP_REPLICATION;

在 33.33.33.33 出现错误:

ERROR 3092 (HY000):服务器未正确配置为组的活动成员。请查看错误日志的更多详细信息。

错误日志:

2018-08-31T13:50:20.850316Z 14 [Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] Automatically adding IPv4 localhost address to the whitelist. It is mandatory that it is added.'
2018-08-31T13:50:20.850719Z 16 [System] [MY-010597] [Repl] 'CHANGE MASTER TO FOR CHANNEL 'group_replication_applier' executed'. Previous state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''. New state master_host='<NULL>', master_port= 0, master_log_file='', master_log_pos= 4, master_bind=''.
2018-08-31T13:50:21.041909Z 0 [Warning] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] read failed'
2018-08-31T13:50:21.056819Z 0 [ERROR] [MY-011735] [Repl] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'

怎么办?

mysql 版本:8.0.12

【问题讨论】:

【参考方案1】:

您正在将通信地址竞价到本地主机地址:

loose-group_replication_local_address="127.0.0.1:33061"

loose-group_replication_local_address="127.0.0.1:33061"

但是您随后尝试使用公共地址联系成员。 如果要公开联系该成员,则需要绑定到公共地址。

【讨论】:

你好@Pedro - 我也面临同样的问题。如果我与本地绑定,则组复制工作,但其他服务器无法加入该组。如果我提供公共 IP,则组复制不会启动。它失败并出现此错误 - There is no local IP address matching the one configured for the local node 知道该怎么做吗?

以上是关于Mysql组复制无法添加实例的主要内容,如果未能解决你的问题,请参考以下文章

MySQL 8 InnoDB 集群生产部署

无法从 EC2 实例连接到 RDS 实例

MySQL的SQL语句 -复制语句(15)- 控制组复制的 SQL 语句 -

Terraform 0.11:无法将动态安全组添加到 aws 实例

只读实例与RO组--助力MySQL实现读写分离,提升扩展性

mysql多实例部署