问题描述

使用MySQL5.7.24 做组复制实验,模式选择主模式,第一台主模式服务器已配置成功,但是在配置第二台服务器加入到配置的组中时报错:

2018-11-28T10:31:51.423293+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.233.136:33061 on local port: 33061.'
2018-11-28T10:31:51.423976+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error on opening a connection to 192.168.233.56:33061 on local port: 33061.'
2018-11-28T10:31:51.424072+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] Error connecting to all peers. Member join failed. Local port: 33061'
2018-11-28T10:31:51.424738+08:00 0 [Warning] Plugin group_replication reported: 'read failed'
2018-11-28T10:31:51.478391+08:00 0 [ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 33061'
2018-11-28T10:32:47.316147+08:00 2 [ERROR] Plugin group_replication reported: 'Timeout on wait for view after joining group'
2018-11-28T10:32:47.316280+08:00 2 [Note] Plugin group_replication reported: 'Requesting to leave the group despite of not being a member'
2018-11-28T10:32:47.316343+08:00 2 [ERROR] Plugin group_replication reported: '[GCS] The member is leaving a group without being on one.'
2018-11-28T10:32:47.316875+08:00 2 [Note] Plugin group_replication reported: 'auto_increment_increment is reset to 1'
2018-11-28T10:32:47.316950+08:00 2 [Note] Plugin group_replication reported: 'auto_increment_offset is reset to 1'
2018-11-28T10:32:47.317598+08:00 7 [Note] Error reading relay log event for channel 'group_replication_applier': slave SQL thread was killed
2018-11-28T10:32:47.317690+08:00 7 [Note] Slave SQL thread for channel 'group_replication_applier' exiting, replication stopped in log 'FIRST' at position 0
2018-11-28T10:32:47.320066+08:00 4 [Note] Plugin group_replication reported: 'The group replication applier thread was killed'

解决方法

经排查,第一台已启动服务器防火墙未关闭,所以需要将33061端口配置在防火墙中或者关闭防火墙即可

centos6

防火墙常用命名

# 查看防火墙状态
service iptables status
 
# 停止防火墙
service iptables stop
 
# 启动防火墙
service iptables start
 
# 重启防火墙
service iptables restart
 
# 永久关闭防火墙
chkconfig iptables off
 
# 永久关闭后重启
chkconfig iptables on

开放33061端口

vim /etc/sysconfig/iptables

在文件中新增

-A INPUT -m state --state NEW -M tcp -p tcp --dport 33061 -j ACCEPT

保存后重启防火墙

service iptables restart

centos7

firewalld常用命令

# 启动 
systemctl start firewalld
# 关闭
systemctl stop firewalld
# 查看状态
systemctl status firewalld 
# 开机禁用 
systemctl disable firewalld
# 开机启用
systemctl enable firewalld
# 查看所有打开的端口
firewall-cmd --zone=public --list-ports

开放33061端口

#  --permanent永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=33061/tcp --permanent

重新载入防火墙

firewall-cmd --reload

再次配置第二台服务器就可以了。

Logo

更多推荐