MGR参数之group_replication_ip_whitelist
尝试将10.133.1.46加入192.168.2.224的集群失败
需要设置参数group_replication_ip_whitelist
此参数虽然是动态参数, 但是要使之生效需要节点重新加入集群
To specify a whitelist manually, use the
group_replication_ip_whitelist
option. You cannot change the whitelist on a server while it is an active member of a replication group. If the member is active, you must issue aSTOP GROUP_REPLICATION
statement before changing the whitelist, and aSTART GROUP_REPLICATION
statement afterwards.
set global group_replication_ip_whitelist = '192.168.0.0/16,10.0.0.0/8';
my.cnf 添加
loose_group_replication_ip_whitelist = '192.168.0.0/16,10.0.0.0/8'
A类IP地址的默认子网掩码为255.0.0.0(由于255相当于二进制的8位1,所以也缩写成“/8”,表示网络号占了8位);B类的为255.255.0.0(/16);C类的为255.255.255.0(/24)。/30就是255.255.255.252。32就是255.255.255.255.
注意这里的16, 24不是看ip a里的值
set global group_replication_ip_whitelist = '192.168.0.0/16,10.0.0.0/8'; 10.x.x.x都可以
set global group_replication_ip_whitelist = '192.168.0.0/16,10.133.0.0/16'; 10.133.x.x都可以
set global group_replication_ip_whitelist = '192.168.0.0/16,10.133.1.0/24'; 10.133.1.x都可以
相关异常
[ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 23307'
2019-12-09T08:18:18.804055Z 0 [Warning] Plugin group_replication reported: '[GCS] Connection attempt from IP address 10.133.1.37 refused. Address is not in the IP whitelist.'
2019-12-09T08:18:18.804092Z 0 [ERROR] Plugin group_replication reported: '[GCS] Error connecting to the local group communication engine instance.'
2019-12-09T08:18:18.922608Z 0 [ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 23307'
注意要加入的节点的group_replication_group_seeds
一定要把设置好group_replication_ip_whitelist
的节点写在最前面,或者删掉没有设置好group_replication_ip_whitelist
的节点, 否则会一直报错
[ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 23307'
举例子
192.168.x.224 group_replication_ip_whitelist='';
192.168.x.225 group_replication_ip_whitelist='192.168.0.0/16,10.133.0.0/16';
192.168.x.226 group_replication_ip_whitelist='192.168.0.0/16,10.133.0.0/16';
要把10.133.1.46加入集群, 而它的group_replication_group_seeds
为192.168.x.224:23310,192.168.x.225:23310,192.168.x.226:23310
那么它会一直报错无法加入集群
同时192.168.x.224会报
原因就是224是10.133.1.46的group_replication_group_seeds
的第一个…