LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: Director and Real Server: Same Machine

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Director and Real Server: Same Machine
From: Horms <horms@xxxxxxxxxxxx>
Date: Wed, 8 Jun 2005 11:06:25 +0900
On Tue, Jun 07, 2005 at 03:16:13PM +0200, Mikel RUIZ ECHEVERRIA wrote:
> I would like to balance the service over two real instances running all on
> the same machine.
> 
> I have tried ldirectord.cf:
> ?
> virtual=158.227.82.39:8090
>         real=158.227.82.39:8091
>         real=158.227.82.39:8092
> 
> And I also have tried:
> ?
> virtual=158.227.82.39:8090
>         real=127.0.0.1:8091
>         real=127.0.0.1:8092
> ?
> but when I start ldirector daemon, I get:
> ?Starting ldirectord Error [] reading file /etc/ha.d/conf/ldirectord.cf at
> line 14: invalid address for real server (wrong format)?
> 
> It seems like IPs of Real Servers could not be the same as the Director
> Server?s one.
> 
> Must  Director and Real Servers run on different machines to work properly
> with LVS?

Unfortunately, what you are trying to do is not possible, and
here is why:

When you set up a real server that is on the same machine
as LVS, it uses a special forwarding mechanism called Local.
It uses this regardless of weather you asked for Masq, Route or
Tun. You can't ask for it, it just knows if the address is
local and sets it. You can however observe it using ipvsadm -L.

The reason for this is running packages that are going to
be delivered to a local process through Masq, Route or Tun
has overhead and in most cases makes very little sense.

However, the downside is that the Local forwarding
mechanism (like Route and Tun, but) unlike Masq
does not allow port-mapping. That is, your port 8090
packets will stay as port 8090 packets. So in a nutshell
IPVS translates your configuration to.

virtual=158.227.82.39:8090
         real=158.227.82.39:8090
         real=158.227.82.39:8090

Which obiously isn't going to workm because you have a duplicate
entry, and that is what the error message you are getting
is trying to say. Well, thats what it should be trying to say,
looks like there might be a bit of a bug in ldirectord somewhere,
but that doesn't change the fact that IPVS can't do what
you want to do.

I believe an easy solution to this problem would
be to deliver the packets to different addresses
rather than different ports. Something like the
following might just work.

virtual=158.227.82.39:8090
         real=127.0.0.1:8090
         real=127.0.0.2:8090

A longer term solution would be to fix up the way the
Local delivery mechanism works. But this would
likely be quite tricky, and certainly increase
its current complexity - its basically a NULL opp
at the moment.

-- 
Horms

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