尝试将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.
1 | set global 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里的值
1 | set global group_replication_ip_whitelist = '192.168.0.0/16,10.0.0.0/8'; 10.x.x.x都可以 |
相关异常
1 | [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
的节点, 否则会一直报错
1 | [ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 23307' |
举例子
1 | 192.168.2.224 group_replication_ip_whitelist=''; |
要把10.133.1.46加入集群, 而它的group_replication_group_seeds
为192.168.2.224:23310,192.168.2.225:23310,192.168.2.226:23310
那么它会一直报错无法加入集群
同时192.168.2.224会报
原因就是224是10.133.1.46的group_replication_group_seeds
的第一个…