MGR參數之group_replication_ip_whitelist

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.

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

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_seeds192.168.x.224:23310,192.168.x.225:23310,192.168.x.226:23310 那麼它會一直報錯無法加入集羣

同時192.168.x.224會報

img

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章