[CentOS] keepalived+LVS

Tue Mar 8 05:45:39 UTC 2011
Steve Barnes <steve at echo.id.au>

> if i only use ha+lvs configuration of keepalived.the  load balance not work.
> then,i install ipvsadm and setup lvs with tun by ipvsadm ,it's work.
> command line below:
> ipvsadm -A -t http://172.16.39.100:80 172.16.39.100:80
> -s rr
> ipvsadm -a -t http://172.16.39.100:80 172.16.39.100:80
> -r http://172.16.39.30:80 172.16.39.30:80
> -i
> ipvsadm -a -t http://172.16.39.100:80 172.16.39.100:80
> -r http://172.16.39.40:80 172.16.39.40:80
> -i
> -------------------------------------------------------------lb server (master) keepalived.conf--------------------------------------------
> global_defs {
>     router_id LVS_DEVEL_M
> }
> vrrp_instance websev {
>     state MASTER
>     interface eth0
>     virtual_router_id 51
>     priority 100        
>     advert_int 1        
>     authentication {
>         auth_type PASS
>         auth_pass 1111
>     }
>     virtual_ipaddress {
>         172.16.39.100
>     }
> }
> virtual_server 172.16.39.100 80 {
>     delay_loop 6
>     lb_algo rr
>     lb_kind TUN
>     persistence_timeout 10
>     protocol TCP
>     real_server 172.16.39.30 80 {
>         weight 1
>         TCP_CHECK {
>             connect_timeout 3
>             nb_get_retry 3
>             delay_before_retry 3
>         }
>     }
>     real_server 172.16.39.40 80 {
>         weight 1
>         TCP_CHECK {
>             connect_timeout 3
>             nb_get_retry 3
>             delay_before_retry 3
>         }
>     }
> }
> ---------------------------------------------------------------real server 1 command ------------------------------------------------------------------
>    ifconfig tunl0 172.16.39.100 netmask 255.255.255.0 up
>    route add -host 172.16.39.100 dev tunl0
>    echo "1" >/proc/sys/net/ipv4/conf/tunl0/arp_ignore
>    echo "2" >/proc/sys/net/ipv4/conf/tunl0/arp_announce
>    echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
>    echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
>    sysctl -p

Assuming I understand you correctly, and assuming you have an init.d script in place, run this command:

     grep daemon /etc/init.d/keepalived

Odds are, you're editing /usr/local/etc/keepalived.conf, but the init.d script starts keepalived and tells it to use /etc/keepalived.conf

?

Steve