免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3132 | 回复: 1
打印 上一主题 下一主题

LVS+KEEPALIVED MASTER BACK 相互不通【已经解决】 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-06-26 11:20 |只看该作者 |倒序浏览
本帖最后由 程序c 于 2013-06-26 14:43 编辑

我想配置一个LVS DR测试服务器
主服务器是 10.1.88.76
备服务器是 10.1.88.77
虚拟IP是 10.1.88.81

问题是根据日志,两个服务器都进入了MASTER状态,可能是相互的通信问题。
1.相互可以PING通
2.两台机器已经关闭了iptables


主服务器配置文件

  1. ! Configuration File for keepalived

  2. global_defs {
  3.    notification_email {
  4.     acassen@firewall.loc
  5.     failover@firewall.loc
  6.         sysadmin@firewall.loc
  7.    }
  8.    notification_email_from test@test.cn
  9.    smtp_server 192.168.200.1
  10.    smtp_connect_timeout 30
  11.    router_id LVS_DEVEL
  12. }

  13. vrrp_instance VI_1 {
  14.     state MASTER
  15.     interface eth0
  16.     virtual_router_id 100
  17.     priority 100
  18.     advert_int 1
  19.     authentication {
  20.         auth_type PASS
  21.         auth_pass 2013
  22.     }
  23.     virtual_ipaddress {
  24.         10.1.88.81
  25.     }
  26. }

  27. virtual_server 10.1.88.81 23 {
  28.     delay_loop 6
  29.     lb_algo rr
  30.     lb_kind DR
  31.     nat_mask 255.255.255.0
  32.     persistence_timeout 50
  33.     protocol TCP

  34.     real_server 10.1.88.78 23 {
  35.         weight 1
  36.         TCP_CHECK {
  37.             connect_timeout 3
  38.             connect_port 23
  39.         }
  40.     }
  41.    
  42.     real_server 10.1.88.79 23{
  43.         weight 1
  44.         TCP_CHECK {
  45.             connect_timeout 3
  46.             connect_port 23
  47.         }
  48.     }
  49.    
  50.     real_server 10.1.88.80 23 {
  51.         weight 1
  52.         TCP_CHECK {
  53.             connect_timeout 3
  54.             connect_port 23
  55.         }
  56.     }
  57. }
复制代码
备用服务器配置文件

  1. ! Configuration File for keepalived

  2. global_defs {
  3.    notification_email {
  4.      acassen@firewall.loc
  5.      failover@firewall.loc
  6.      sysadmin@firewall.loc
  7.    }
  8.    notification_email_from test@test.cn
  9.    smtp_server 192.168.200.1
  10.    smtp_connect_timeout 30
  11.    router_id LVS_DEVEL
  12. }

  13. vrrp_instance VI_1 {
  14.     state BACKUP
  15.     interface eth0
  16.     virtual_router_id 101
  17.     priority 90
  18.     advert_int 1
  19.     authentication {
  20.         auth_type PASS
  21.         auth_pass 2013
  22.     }
  23.     virtual_ipaddress {
  24.         10.1.88.81
  25.     }
  26. }

  27. virtual_server 10.1.88.81 23 {
  28.     delay_loop 6
  29.     lb_algo rr
  30.     lb_kind DR
  31.     nat_mask 255.255.255.0
  32.     persistence_timeout 50
  33.     protocol TCP

  34.     real_server 10.1.88.78 23 {
  35.         weight 1
  36.         TCP_CHECK {
  37.             connect_timeout 3
  38.             connect_port 23
  39.         }
  40.     }
  41.    
  42.     real_server 10.1.88.79 23{
  43.         weight 1
  44.         TCP_CHECK {
  45.             connect_timeout 3
  46.             connect_port 23
  47.         }
  48.     }
  49.    
  50.     real_server 10.1.88.80 23 {
  51.         weight 1
  52.         TCP_CHECK {
  53.             connect_timeout 3
  54.             connect_port 23
  55.         }
  56.     }
  57. }


复制代码
两个服务器的日志文件

主服务器

  1. Jun 26 11:06:41 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) sending 0 priority
  2. Jun 26 11:06:41 node0 Keepalived[1262]: Stopping Keepalived v1.2.7 (02/21,2013)
  3. Jun 26 11:07:44 node0 Keepalived[1261]: Starting Keepalived v1.2.7 (02/21,2013)
  4. Jun 26 11:07:44 node0 Keepalived[1262]: Starting Healthcheck child process, pid=1263
  5. Jun 26 11:07:44 node0 Keepalived[1262]: Starting VRRP child process, pid=1264
  6. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Interface queue is empty
  7. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Netlink reflector reports IP 10.1.88.76 added
  8. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Netlink reflector reports IP fe80::5054:ff:fe8f:97f6 added
  9. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Registering Kernel netlink reflector
  10. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Registering Kernel netlink command channel
  11. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Registering gratuitous ARP shared channel
  12. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Interface queue is empty
  13. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Netlink reflector reports IP 10.1.88.76 added
  14. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Netlink reflector reports IP fe80::5054:ff:fe8f:97f6 added
  15. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Registering Kernel netlink reflector
  16. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Registering Kernel netlink command channel
  17. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Opening file '/etc/keepalived/keepalived.conf'.
  18. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Opening file '/etc/keepalived/keepalived.conf'.
  19. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Configuration is using : 63254 Bytes
  20. Jun 26 11:07:44 node0 Keepalived_vrrp[1264]: Using LinkWatch kernel netlink reflector...
  21. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Configuration is using : 17141 Bytes
  22. Jun 26 serial8250: too much work for irq4
  23. 11:07:44 node0 Keepalived_vrrp[1264]: VRRP sockpool: [ifindex(2), proto(112), fd(11,12)]
  24. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Using LinkWatch kernel netlink reflector...
  25. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Activating healthchecker for service [10.1.88.78]:23
  26. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Activating healthchecker for service [10.1.88.79]:23
  27. Jun 26 11:07:44 node0 Keepalived_healthcheckers[1263]: Activating healthchecker for service [10.1.88.80]:23
  28. Jun 26 11:07:45 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) Transition to MASTER STATE
  29. Jun 26 11:07:46 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) Entering MASTER STATE
  30. Jun 26 11:07:46 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) setting protocol VIPs.
  31. Jun 26 11:07:46 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.1.88.81
  32. Jun 26 11:07:46 node0 Keepalived_healthcheckers[1263]: Netlink reflector reports IP 10.1.88.81 added
  33. Jun 26 11:07:51 node0 Keepalived_vrrp[1264]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.1.88.81
  34. [root@node0 ~]# date
  35. Wed Jun 26 11:08:08 CST 2013
复制代码
备用服务器

  1. Jun 26 11:07:50 node1 Keepalived[1284]: Starting Keepalived v1.2.7 (02/21,2013)
  2. Jun 26 11:07:50 node1 Keepalived[1285]: Starting Healthcheck child process, pid=1286
  3. Jun 26 11:07:50 node1 Keepalived[1285]: Starting VRRP child process, pid=1287
  4. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Interface queue is empty
  5. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Netlink reflector reports IP 10.1.88.77 added
  6. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Netlink reflector reports IP fe80::5054:ff:fee6:54b7 added
  7. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Registering Kernel netlink reflector
  8. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Registering Kernel netlink command channel
  9. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Registering gratuitous ARP shared channel
  10. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Interface queue is empty
  11. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Opening file '/etc/keepalived/keepalived.conf'.
  12. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Netlink reflector reports IP 10.1.88.77 added
  13. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Netlink reflector reports IP fe80::5054:ff:fee6:54b7 added
  14. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Registering Kernel netlink reflector
  15. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Registering Kernel netlink command channel
  16. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Opening file '/etc/keepalived/keepalived.conf'.
  17. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Configuration is using : 63252 Bytes
  18. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: Using LinkWatch kernel netlink reflector...
  19. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Configuration is using : 17139 Bytes
  20. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) Entering BACKUP STATE
  21. Jun 26 11:07:50 node1 Keepalived_vrrp[1287]: VRRP sockpool: [ifindex(2), proto(112), fd(11,12)]
  22. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Using LinkWatch kernel netlink reflector...
  23. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Activating healthchecker for service [10.1.88.78]:23
  24. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Activating healthchecker for service [10.1.88.79]:23
  25. Jun 26 11:07:50 node1 Keepalived_healthcheckers[1286]: Activating healthchecker for service [10.1.88.80]:23
  26. Jun 26 11:07:53 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) Transition to MASTER STATE
  27. Jun 26 11:07:54 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) Entering MASTER STATE
  28. Jun 26 11:07:54 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) setting protocol VIPs.
  29. Jun 26 11:07:54 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.1.88.81
  30. Jun 26 11:07:54 node1 Keepalived_healthcheckers[1286]: Netlink reflector reports IP 10.1.88.81 added
  31. Jun 26 11:07:59 node1 Keepalived_vrrp[1287]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 10.1.88.81
复制代码
问题已经解决
I found the solution of this problem. The master virtual_router_id should equal to backup's.I found the solution of this problem. The master virtual_router_id should equal to backup's.

论坛徽章:
0
2 [报告]
发表于 2013-07-19 16:27 |只看该作者
顶,主备服务器的virtual_router_id必须相同!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP