[CentOS] keepalived+LVS

Tue Mar 8 05:28:17 UTC 2011
bedo <bedo.wang at gmail.com>

thanks for relay!
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 172.16.39.100:80 -s rr
ipvsadm -a -t 172.16.39.100:80 -r 172.16.39.30:80 -i
ipvsadm -a -t 172.16.39.100:80 -r 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
--------------------------------------------------------------------------------------------------------------------------------------------------


2011/3/8 Steve Barnes <steve at echo.id.au>

> >   all!
> > if i want to use lvs function of keepalived , i must install ipvsadm ?
> > tks!
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> > http://lists.centos.org/mailman/listinfo/centos
> >
>
> [steve at mail ~]$ yum provides '*/ipvsadm'
> Loaded plugins: fastestmirror
> addons
>
>                                  |  951 B
> 00:00
> base
>
>                                  | 2.1 kB
> 00:00
> extras
>
>                                  | 2.1 kB
> 00:00
> updates
>
>                                 | 1.9 kB
> 00:00
> ipvsadm-1.24-10.x86_64 : Utility to administer the Linux Virtual Server
> Repo        : base
> Matched from:
> Filename    : /etc/rc.d/init.d/ipvsadm
> Filename    : /sbin/ipvsadm
>
> I use keepalived/lvs. Yes, you need to install it. Otherwise, there's no
> way for you to manage the lvs function?
>
> At least, that's what I've been led to believe...
>
> Cheers
>
> Steve
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20110308/7110974c/attachment-0005.html>