- 论坛徽章:
- 0
|
使用俩台主机安装keepalived+lvs,俩台主机做real server,lvs为DR模式,采用rr机制,测试时发现对于vip:192.168.122.100的请求都只能发送到其中一台real server上,不能交替的发给后端俩台real server ,没有实现轮询的机制,请指导~
keepalived配置文件
! Configuration File for keepalived
global_defs {
router_id director1
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.122.100
}
}
virtual_server 192.168.122.100 80 {
delay_loop 6
lb_algo rr
lb_kind DR
nat_mask 255.255.255.0
persistence_timeout 50
protocol TCP
real_server 192.168.122.4 80 {
weight 1
HTTP_GET {
url {
path /test1.html
digest 2ee55cb8cb23a5db1580d14aa37a5d27
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
real_server 192.168.122.5 80 {
weight 1
HTTP_GET {
url {
path /test2.html
digest 8145db84654bc4c9dc5fa077a788c9db
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
}
}
}
测试
# ab -c 100 -n 100 http://192.168.122.100/
ipvsadm查询
Every 0.5s: ipvsadm -Lnc Sun Nov 17 06:16:34 2013
IPVS connection entries
pro expire state source virtual destination
TCP 01:26 FIN_WAIT 192.168.122.1:39157 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39142 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39105 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39099 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39191 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39155 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39123 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39180 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39188 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39150 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39109 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39175 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39194 192.168.122.100:80 192.168.122.4:80
TCP 01:27 FIN_WAIT 192.168.122.1:39195 192.168.122.100:80 192.168.122.4:80
TCP 01:26 FIN_WAIT 192.168.122.1:39146 192.168.122.100:80 192.168.122.4:80
..............................
|
|