MGR参数之group_replication_ip_whitelist

img

尝试将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 a STOP GROUP_REPLICATION statement before changing the whitelist, and a START GROUP_REPLICATION statement afterwards.

1
2
3
4
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里的值

img

1
2
3
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都可以

相关异常

1
2
3
4
5
6
[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的节点, 否则会一直报错

1
[ERROR] Plugin group_replication reported: '[GCS] The member was unable to join the group. Local port: 23307'

举例子

1
2
3
192.168.2.224 group_replication_ip_whitelist='';
192.168.2.225 group_replication_ip_whitelist='192.168.0.0/16,10.133.0.0/16';
192.168.2.226 group_replication_ip_whitelist='192.168.0.0/16,10.133.0.0/16';

要把10.133.1.46加入集群, 而它的group_replication_group_seeds192.168.2.224:23310,192.168.2.225:23310,192.168.2.226:23310 那么它会一直报错无法加入集群

同时192.168.2.224会报

img

原因就是224是10.133.1.46的group_replication_group_seeds的第一个…

Powered by Hexo and Hexo-theme-hiker

Copyright © 2013 - 2020 Fan() All Rights Reserved.

访客数 : | 访问量 :

#