关于lvs+keepalived只加入一台realserver问题
今天做lvs+keepalived+mysql项目实施方案,在配置lvs+keepalived时都是ok的,但是就只加入第一台realserver。本人也感到很奇怪,lvs+keepalived本人也在实验环境下做过很多次了,但是还是出问题了,后来对比配置文件终于发现问题所在。
问题前:
[root@lvsA keepalived]# ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 10.10.1.200:3306 rr persistent 50 -> 10.10.1.201:3306 Route 100 0 0
解决方法:
[root@lvsA keepalived]# vim /etc/keepalived/keepalived.conf
TCP_CHECK { <--在所有的realserver配置段的这里要加一个空格
问题解决后:
[root@lvsA etc]# /etc/init.d/keepalived restart <--重启一下keepalived Stopping keepalived: [ OK ] Starting keepalived: [ OK ] [root@lvsA etc]# ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 10.10.1.200:3306 rr persistent 50 -> 10.10.1.201:3306 Route 100 0 0 -> 10.10.1.202:3306 Route 100 0 0 -> 10.10.1.203:3306 Route 100 0 0 [root@lvsA etc]#