LVS+keepalived+squid 可以热备,但不均衡负载ActiveConn InActConn一直为0,求大神帮忙

我做了lvs+keepalived+squid
系统centos6.4
内核2.6.32-358.el6.i686
测试客户端20+
问题客户端可以通过代理访问网站,但只会一直通过squid1 MASTER这一台,只有当master宕机才会通过squid2访问网站;
两台ipvsadm结果始终是
[root@squid1 ~]# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
UDP 10.224.99.248:3128 rr persistent 1
-> 10.224.99.246:3128 Local 1 0 0
-> 10.224.99.247:3128 Route 1 0 0

想通过LVS实现均衡负载失败,求大神指点~看看这个配置脚本有啥问题会导致这样的情况

主机keepalived配置
! Configuration File for keepalived

global_defs {
notification_email {
xxxx@163.com
}
notification_email_from xxx@163.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS1
}

vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 60
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.224.99.243
}
}

virtual_server 10.224.99.243 3128 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP

real_server 10.224.99.245 3128 {
eight 1
TCP_CHECK {
nb_get_retry 3
delay_before_retry 3
connect_port 3128
connect_timeout 10
}
}
real_server 10.224.99.244 3128 {
eight 1
TCP_CHECK {
nb_get_retry 3
delay_before_retry 3
connect_port 3128
connect_timeout 10
}
}

}

备机配置
! Configuration File for keepalived

global_defs {
notification_email {
xxx@163.com
}
notification_email_from xxx@163.com
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS2
}

vrrp_instance VI_1 {
state BACKUP
interface eth1
virtual_router_id 60
priority 99
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.224.99.243
}
}

virtual_server 10.224.99.243 3128 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP

real_server 10.224.99.245 3128 {
eight 1
TCP_CHECK {
nb_get_retry 3
delay_before_retry 3
connect_port 3128
connect_timeout 10
}
}
real_server 10.224.99.244 3128 {
eight 1
TCP_CHECK {
nb_get_retry 3
delay_before_retry 3
connect_port 3128
connect_timeout 10
}
}

}

Forums:

这属于LVS自身的问题,LVS并不是商业化的产品,所以并不完善,我分析了一下源码,得出结果如下:
1) 你的配置中带了-p选项,内核中的统计计数保存在内核的persistconns变量中,ipvsadm工具并没有显示内核的persistconns这个变量。如果你去掉-p选项,统计计数会保存在InActConn变量中,所以InActConn应该会有值。
2)ActiveConn在TCP协议才有效。

综上两点,所以在你的那种配置下(带-p选项的UDP协议服务),InActConn和ActiveConn都会一直为0。

【 你的配置:UDP 10.224.99.248:3128 rr persistent 1
-> 10.224.99.246:3128 Local 1 0 0
-> 10.224.99.247:3128 Route 1 0 0 】

10.224.99.246:3128 Local 1 0 0
-> 10.224.99.247:3128 Route 1 0 0 这里也是一直显示0但是可以代理上网,只是不知道为什么通过设置代理地址(VIP的地址 端口)去访问网站,对方网站显示的是VIP的IP地址去访问的,而不是real主机去访问的 为什么