本帖最后由 earl86 于 2024-11-19 13:55 编辑
集群,节点1,2,3 代表3台物理服务器.
单机多实例配置:
三个实例配置分别如下: 这3个实例 分属不同的 mgr集群,每个 mgr集群有自己独立的vip
以下为 其中一台物理服务器上的实例配置. 其他两台 各实例将对应的report_host 分别为:192.168.2.247, 192.168.2.248
===========================================
bind_address = 0.0.0.0
port = 3316
report_host = 192.168.2.246
report_port = 3316
#*** GreatSQL mgr vip Specific settings ***
loose-plugin_load_add = 'greatdb_ha.so'
loose-greatdb_ha_enable_mgr_vip = 1
loose-greatdb_ha_mgr_vip_nic = 'bond0:1000'
loose-greatdb_ha_mgr_vip_ip = '192.168.1.25'
loose-greatdb_ha_mgr_vip_mask = '255.255.0.0'
===========================================
bind_address = 0.0.0.0
port = 3326
report_host = 192.168.2.246
report_port = 3326
#*** GreatSQL mgr vip Specific settings ***
loose-plugin_load_add = 'greatdb_ha.so'
loose-greatdb_ha_enable_mgr_vip = 1
loose-greatdb_ha_mgr_vip_nic = 'bond0:1001'
loose-greatdb_ha_mgr_vip_ip = '192.168.1.26'
loose-greatdb_ha_mgr_vip_mask = '255.255.0.0'
===========================================
bind_address = 0.0.0.0
port = 3336
report_host = 192.168.2.246
report_port = 3336
#*** GreatSQL mgr vip Specific settings ***
loose-plugin_load_add = 'greatdb_ha.so'
loose-greatdb_ha_enable_mgr_vip = 1
loose-greatdb_ha_mgr_vip_nic = 'bond0:1002'
loose-greatdb_ha_mgr_vip_ip = '192.168.1.27'
loose-greatdb_ha_mgr_vip_mask = '255.255.0.0'
3个集群启动后 会自动绑定各自的vip到 primary节点的服务器上 当前3个集群 primary节点 均在节点1上
ifconfig
bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.2.246 netmask 255.255.0.0 broadcast 192.168.255.255
bond0:1000:0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.1.25 netmask 255.255.0.0 broadcast 192.168.255.255
bond0:1001:0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.1.26 netmask 255.255.0.0 broadcast 192.168.255.255
bond0:1002:0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500
inet 192.168.1.27 netmask 255.255.0.0 broadcast 192.168.255.255
但是 当通过mysql shell 或 udf 传统 方式 主动指定 primary节点时
c.setPrimaryInstance('192.168.2.247:3316')
vip 在原来的主节点服务器上不会主动释放, 会造成类似脑裂的问题
经测试单机单实例时功能正常. 单机多实例 对于多个集群的vip管理功能异常.
解决:
3个集群的配置文件中 分别 添加
loose-greatdb_ha_port = 33162
loose-greatdb_ha_port = 33262
loose-greatdb_ha_port = 33362
重启集群.
附log:
==============================================
- 源主库
- 2024-11-15T00:44:21.757900-08:00 277 [System] [MY-013214] [Repl] Plugin group_replication reported: 'Starting group operation local execution: Primary election change'
- 2024-11-15T00:44:21.762822-08:00 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address 192.168.2.247:3316 was elected. The new primary will execute all previous group transactions before allowing w
- rites. Enabling conflict detection until the new primary applies all relay logs.'
- 2024-11-15T00:44:21.764115-08:00 278 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
- 2024-11-15T00:44:21.774908-08:00 278 [System] [MY-011511] [Repl] Plugin group_replication reported: 'This server is working as secondary member with primary member address 192.168.2.247:3316.'
- 2024-11-15T00:44:21.774948-08:00 277 [Note] [MY-013215] [Repl] Plugin group_replication reported: 'Termination of group operation local execution: Primary election change'
- 2024-11-15T00:44:21.775029-08:00 231 [Note] [MY-011485] [Repl] Plugin group_replication reported: 'Primary had applied all relay logs, disabled conflict detection.'
- 2024-11-15T00:44:21.775981-08:00 0 [System] [MY-013213] [Repl] Plugin group_replication reported: 'Configuration operation 'Primary election change' terminated. Primary server switched to: ca348a8c-a312-11ef-9854-ac1f6bdb80fe'
- 目标 主库:
- 2024-11-15T00:44:21.759272-08:00 275 [System] [MY-013214] [Repl] Plugin group_replication reported: 'Starting group operation local execution: Primary election change'
- 2024-11-15T00:44:21.763051-08:00 0 [Note] [MY-013519] [Repl] Plugin group_replication reported: 'Elected primary member gtid_executed: bea16249-a312-11ef-adf7-ac1f6bdb81d2:1-32, e7895b9b-a31b-11ef-8c27-ac1f6bdb81d2:1-89, e7896234-a31b
- -11ef-8c27-ac1f6bdb81d2:1-11'
- 2024-11-15T00:44:21.763150-08:00 0 [Note] [MY-013519] [Repl] Plugin group_replication reported: 'Elected primary member applier channel received_transaction_set: bea16249-a312-11ef-adf7-ac1f6bdb81d2:1-32, e7895b9b-a31b-11ef-8c27-ac1f6
- bdb81d2:1-89, e7896234-a31b-11ef-8c27-ac1f6bdb81d2:1-11'
- 2024-11-15T00:44:21.763180-08:00 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address 192.168.2.247:3316 was elected. The new primary will execute all previous group transactions before allowing w
- rites. Enabling conflict detection until the new primary applies all relay logs.'
- 2024-11-15T00:44:21.763900-08:00 276 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
- 2024-11-15T00:44:21.765008-08:00 233 [System] [MY-013731] [Repl] Plugin group_replication reported: 'The member action "mysql_disable_super_read_only_if_primary" for event "AFTER_PRIMARY_ELECTION" with priority "1" will be run.'
- 2024-11-15T00:44:21.765065-08:00 233 [System] [MY-011566] [Repl] Plugin group_replication reported: 'Setting super_read_only=OFF.'
- 2024-11-15T00:44:21.765198-08:00 233 [System] [MY-013731] [Repl] Plugin group_replication reported: 'The member action "mysql_start_failover_channels_if_primary" for event "AFTER_PRIMARY_ELECTION" with priority "10" will be run.'
- 2024-11-15T00:44:21.774529-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.246:0 failed return -3'
- 2024-11-15T00:44:21.774893-08:00 276 [System] [MY-011510] [Repl] Plugin group_replication reported: 'This server is working as primary member.'
- 2024-11-15T00:44:21.774909-08:00 275 [Note] [MY-013215] [Repl] Plugin group_replication reported: 'Termination of group operation local execution: Primary election change'
- 2024-11-15T00:44:21.775068-08:00 225 [Note] [MY-011485] [Repl] Plugin group_replication reported: 'Primary had applied all relay logs, disabled conflict detection.'
- 2024-11-15T00:44:21.775826-08:00 0 [System] [MY-013213] [Repl] Plugin group_replication reported: 'Configuration operation 'Primary election change' terminated. Primary server switched to: ca348a8c-a312-11ef-9854-ac1f6bdb80fe'
- 2024-11-15T00:44:21.781015-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.246:0 failed return -3'
- 2024-11-15T00:44:21.781143-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.246:0 failed return -3'
- 2024-11-15T00:44:21.804386-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.246:0 failed return -3'
- 2024-11-15T00:44:21.804420-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'try to connect or send message to bea16249-a312-11ef-adf7-ac1f6bdb81d2 failed when get node bind message'
- 2024-11-15T00:44:21.817273-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.248:0 failed return -3'
- 2024-11-15T00:44:21.823532-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.248:0 failed return -3'
- 2024-11-15T00:44:21.823646-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.248:0 failed return -3'
- 2024-11-15T00:44:21.828941-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'connect_with_timeout 192.168.2.248:0 failed return -3'
- 2024-11-15T00:44:21.828961-08:00 0 [ERROR] [MY-000000] [Server] Plugin greatdb_ha reported: 'try to connect or send message to d154d45e-a312-11ef-ba18-ac1f6bdb815c failed when get node bind message'
- 2024-11-15T00:44:22.369481-08:00 0 [Warning] [MY-000000] [Server] Plugin greatdb_ha reported: 'try to bind vip : 192.168.1.25 success'
复制代码
|