LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: ldirectord: wrong RIP port in if VIP port != RIP port

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: ldirectord: wrong RIP port in if VIP port != RIP port
From: Horms <horms@xxxxxxxxxxxx>
Date: Wed, 30 Nov 2005 01:24:19 +0000 (UTC)
sll <simonluca.landi@xxxxxxxxx> wrote:
> Hi all,
>  I'm using ldirectord+heartbeat+lvs (Ultramonkey) to load balance a
> group of web
> servers.
> ldirecotrd is 1.77.2.32 2005/09/21
> 
> When I create a virtual entry and set the VIP port to 8081, but the
> real  server port to 8082, ldirectord adds two entries in the LVS
> table for each real server: one for RIP:8082 with a weight of 1 and
> one with RIP:8081 with a weight of zero.
> 
> This is the ldirectord.cf:
> 
> # Virtual Server for HTTP BackEnd Tomcat
> virtual=xxx.xxx.xxx.xxx:8081
>        real=10.0.1.1:8082 masq
>        service=http
>        request="status.html"
>        receive="on"
>        scheduler=rr
>        #persistent=600
>        protocol=tcp
>        checktype=negotiate
> 
> After a restart of ldirectord
> ipvs -L -n said:
> 
> IP Virtual Server version 1.2.0 (size=4096)
> Prot LocalAddress:Port Scheduler Flags
>  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
> TCP  xxx.xxx.xxx.xxx:8081 rr
>  -> 10.0.1.1:8082     Masq    1      0          0
> 
> I shutdown tomcat on real server, and
> 
> ipvs -L -n said:
> 
> IP Virtual Server version 1.2.0 (size=4096)
> Prot LocalAddress:Port Scheduler Flags
>  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
> TCP  xxx.xxx.xxx.xxx:8081 rr
>  -> 10.0.1.1:8081                Masq    0      0          0
> 
> As you can see, the "quiescient" server is on port 8081, not 8082
> Now I start tomcat on real server:
> 
> ipvs -L -n said:
> 
> IP Virtual Server version 1.2.0 (size=4096)
> Prot LocalAddress:Port Scheduler Flags
>  -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
> TCP  xxx.xxx.xxx.xxx:8081 rr
>  -> 10.0.1.1:8082                Masq    1      0          0
>  -> 10.0.1.1:8081                Masq    1      0          0
> 
> As you can see, the real server is correctly added to ldirectord, but
> a fake entry is added from the quiescient server (I have another
> webserver on port 8081)
> 
> usign /usr/sbin/ldirectord reload the correct config is reloaded.
> 
> I think that the problem in ldirectord script is that when a queiscent
> server is added, the vip port and not the rip port is used. I'm not
> very used to perl progrmming, so I don't try to fix it...

Hi, 

sorry for the slow response, I've only been grazing mailing lists of late.
Please, anyone who wants to get my attention on LVS issues, CC me on
the message.

Your diagnosis is correct. Its caused by some convoluted handling of
services whose real servers are on different ports that is needed
because if a forwarding meachinsim other than LVS-NAT (masq) is used, or
the IP address of the real server happens to be local, in which case
LVS-LOCAL will be used, then LVS fores the real-server's port to
be the same as the virtual service.

Unfortunately, the logic that handles that case doesn't handle
the case where the real-server is missing from the LVS table for
some (legitimate) reason.

Can you please test this patch out to see if it helps,
I think that it will resolve your problem.

Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.77.2.36
diff -u -r1.77.2.36 ldirectord
--- ldirectord  30 Oct 2005 05:46:04 -0000      1.77.2.36
+++ ldirectord  30 Nov 2005 01:21:02 -0000
@@ -2381,6 +2381,16 @@
                $virtual_str =~ /(.*):(.*)/;
                $rservice .= ":" . $2;
                $or=$ov->{"real"}->{$rservice};
+               # If this doesn't exist either, use the original service.
+               # Otherwise if masq and quescence is in use, the
+               # real server is not local, and it has an alternate port to
+               # the virtual server, using the mapped service will
+               # result in a quiescent service being created on the
+               # virtual server's port, which is not wanted.
+               if(!defined($or)) {
+                       $rservice = $old_rservice;
+                       $old_rservice = undef;
+               }
        }
 
         if((!defined($or) and !defined($is_quiescent)) or 



-- 
Horms


<Prev in Thread] Current Thread [Next in Thread>