GreatSQL社区

搜索

[已解决] GreatSQL-8.0.32-26 单机多实例场景 vip 功能不能切换问题

86 3 2024-11-15 17:05
本帖最后由 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:
==============================================
  1. 源主库
  2. 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'
  3. 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
  4. rites. Enabling conflict detection until the new primary applies all relay logs.'
  5. 2024-11-15T00:44:21.764115-08:00 278 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
  6. 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.'
  7. 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'
  8. 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.'
  9. 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'



  10. 目标 主库:
  11. 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'
  12. 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
  13. -11ef-8c27-ac1f6bdb81d2:1-11'
  14. 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
  15. bdb81d2:1-89, e7896234-a31b-11ef-8c27-ac1f6bdb81d2:1-11'
  16. 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
  17. rites. Enabling conflict detection until the new primary applies all relay logs.'
  18. 2024-11-15T00:44:21.763900-08:00 276 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
  19. 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.'
  20. 2024-11-15T00:44:21.765065-08:00 233 [System] [MY-011566] [Repl] Plugin group_replication reported: 'Setting super_read_only=OFF.'
  21. 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.'
  22. 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'
  23. 2024-11-15T00:44:21.774893-08:00 276 [System] [MY-011510] [Repl] Plugin group_replication reported: 'This server is working as primary member.'
  24. 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'
  25. 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.'
  26. 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'
  27. 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'
  28. 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'
  29. 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'
  30. 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'
  31. 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'
  32. 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'
  33. 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'
  34. 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'
  35. 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'
  36. 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'
复制代码

全部回复(3)
yejr 2024-11-15 17:19:29
切换主节点时的日志也请提供,以及是否有触发VIP切换的动作相关的日志
yejr 2024-11-16 07:13:51
在GreatSQL 8.0.32-26版本中,配置VIP时,还需要配置 greatdb_ha_port 端口,否则无法正常工作,详情参考 https://greatsql.cn/docs/8.0.32-26/5-enhance/5-2-ha-mgr-vip.html

此外,看到源主库上没有 unbind 动作,但是在新的目标主库上却有 bind success 的日志,还请确认是否日志没贴完整,还是其他什么情况。
earl86 2024-11-19 13:38:26
本帖最后由 earl86 于 2024-11-19 13:43 编辑

GreatSQL-8.0.32-26 这个问题 找到原因了, greatdb_ha_port 这个参数 需要配上. 配上后 源主库就可以收到停止vip的消息.
  1. 源主库
  2. 2024-11-18T21:32:29.301178-08:00 271 [System] [MY-013214] [Repl] Plugin group_replication reported: 'Starting group operation local execution: Primary election change'
  3. 2024-11-18T21:32:29.302638-08:00 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address 192.168.2.248:3316 was elected. The new primary will execute all previous group transactions before allowing writes. Enabling conflict detection until the new primary applies all relay logs.'
  4. 2024-11-18T21:32:29.303398-08:00 272 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
  5. 2024-11-18T21:32:29.311920-08:00 272 [System] [MY-011511] [Repl] Plugin group_replication reported: 'This server is working as secondary member with primary member address 192.168.2.248:3316.'
  6. 2024-11-18T21:32:29.311917-08:00 232 [Note] [MY-011485] [Repl] Plugin group_replication reported: 'Primary had applied all relay logs, disabled conflict detection.'
  7. 2024-11-18T21:32:29.311980-08:00 271 [Note] [MY-013215] [Repl] Plugin group_replication reported: 'Termination of group operation local execution: Primary election change'
  8. 2024-11-18T21:32:29.312849-08:00 0 [System] [MY-013213] [Repl] Plugin group_replication reported: 'Configuration operation 'Primary election change' terminated. Primary server switched to: d154d45e-a312-11ef-ba18-ac1f6bdb815c'
  9. 2024-11-18T21:32:29.828145-08:00 0 [Warning] [MY-000000] [Server] Plugin greatdb_ha reported: 'kill connections binding to vip: 192.168.1.25'
  10. 2024-11-18T21:32:29.828216-08:00 0 [Warning] [MY-000000] [Server] Plugin greatdb_ha reported: 'try to unbind vip : 192.168.1.25 success'



  11. 目标主库
  12. 2024-11-18T21:32:29.301072-08:00 226 [System] [MY-013214] [Repl] Plugin group_replication reported: 'Starting group operation local execution: Primary election change'
  13. 2024-11-18T21:32:29.302685-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-119, e7896234-a31b-11ef-8c27-ac1f6bdb81d2:1-22'
  14. 2024-11-18T21:32:29.302747-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-ac1f6bdb81d2:1-119, e7896234-a31b-11ef-8c27-ac1f6bdb81d2:1-22'
  15. 2024-11-18T21:32:29.302761-08:00 0 [System] [MY-011507] [Repl] Plugin group_replication reported: 'A new primary with address 192.168.2.248:3316 was elected. The new primary will execute all previous group transactions before allowing writes. Enabling conflict detection until the new primary applies all relay logs.'
  16. 2024-11-18T21:32:29.303415-08:00 227 [System] [MY-011565] [Repl] Plugin group_replication reported: 'Setting super_read_only=ON.'
  17. 2024-11-18T21:32:29.303979-08:00 205 [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.'
  18. 2024-11-18T21:32:29.304021-08:00 205 [System] [MY-011566] [Repl] Plugin group_replication reported: 'Setting super_read_only=OFF.'
  19. 2024-11-18T21:32:29.304162-08:00 205 [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.'
  20. 2024-11-18T21:32:29.311926-08:00 227 [System] [MY-011510] [Repl] Plugin group_replication reported: 'This server is working as primary member.'
  21. 2024-11-18T21:32:29.311928-08:00 197 [Note] [MY-011485] [Repl] Plugin group_replication reported: 'Primary had applied all relay logs, disabled conflict detection.'
  22. 2024-11-18T21:32:29.311934-08:00 226 [Note] [MY-013215] [Repl] Plugin group_replication reported: 'Termination of group operation local execution: Primary election change'
  23. 2024-11-18T21:32:29.312811-08:00 0 [System] [MY-013213] [Repl] Plugin group_replication reported: 'Configuration operation 'Primary election change' terminated. Primary server switched to: d154d45e-a312-11ef-ba18-ac1f6bdb815c'
  24. 2024-11-18T21:32:29.827174-08:00 0 [Warning] [MY-000000] [Server] Plugin greatdb_ha reported: 'try to bind vip : 192.168.1.25 success'
复制代码
earl86

8

主题

0

博客

47

贡献

注册会员

Rank: 2

积分
76

助人为乐(铜)

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-12-4 21:16 , Processed in 0.023319 second(s), 16 queries , Redis On.
快速回复 返回顶部 返回列表