LVS+Keepalived 之IPVSADM问题
从网络上安装配置了LVS+Keepalived。现在有一些故障,请大家帮忙查看下。
PS:我的OS是Centos5.3,安装了keepalived-1.1.19和ipvsadm-1.24。
1.keepalived.conf配置文件:
! Configuration File for keepalived
global_defs {
notification_email {
924735071@qq.com
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id LVS_Master
}
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.11.187
}
}
virtual_server 192.168.11.187 80 {
delay_loop 6
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.11.189 80 {
weight 4
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
real_server 192.168.11.190 80 {
weight 3
TCP_CHECK {
connect_timeout 3
nb_get_retry 3
delay_before_retry 3
connect_port 80
}
}
}
2.real server上的lvsrs配置:
#!/bin/bash
#description : start realserver
VIP=192.168.11.187
/etc/rc.d/init.d/functions
case "$1" in
start)
echo " start LVS of REALServer"
/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up
echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
stop)
/sbin/ifconfig lo:0 down
echo "close LVS Directorserver"
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
现在我在LVS主机down掉keepalived服务之后备机会接管过去,开启服务后主机会接管回来。但是无法做到负载均衡和故障切换。
先总结具体情况如下:
1-1.主MASTER的IP
[root@lvs1 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:32:FC:50
inet addr:192.168.11.185 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe32:fc50/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:360389 errors:0 dropped:0 overruns:0 frame:0
TX packets:86329 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:29243772 (27.8 MiB) TX bytes:5040263 (4.8 MiB)
Base address:0x2000 Memory:d1020000-d1040000
1-2.Director SERVER的 IPVSADM 命令
[root@lvs1 ~]# ipvsadm
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
网上都是[root@localhost ~]# ipvsadm -L
IP Virtual Server version 1.2.0 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
TCP 192.168.228.244:ftp rr
-> 192.168.228.210:ftp Route 1 0 0
-> 192.168.228.227:ftp Local 1 0 0
我不明白错误到底发生在哪里?请大家帮忙查看。
- michael1943's blog
- Log in or register to post comments
- 9199 reads