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
的第一個…