LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

[lvs-users] two VIPS on same port (w/ direct routing)

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: [lvs-users] two VIPS on same port (w/ direct routing)
From: "Matthias Zeichmann" <matthias.zeichmann@xxxxxxxxx>
Date: Thu, 6 Mar 2008 11:04:14 +0100
hi list,

following scenario:
one director with 1 VIP and two realservers with a couple of websites
running in virtualhosts on apache aside of openx [0] adserver.

adserver eats up precious memory so the idea was to split that out
into lighttpd processes and add a second VIP.

after a bit of fiddling i eventually found a way to do it, which i'd
like to share

so we have

ldirectord.cf:
------------->8---------------------------------
## WEB
virtual=www.my.org:80
        real=rs1.my.org:80 gate 1
        real=rs2.my.org:80 gate 1
        service=http
        checktype=connect
        scheduler=wlc
        quiescent=yes
        protocol=tcp
## ADS
virtual=ads.my.org:80
        real=rs1.my.org:80 gate 1
        real=rs2.my.org:80 gate 1
        service=http
        checktype=connect
        scheduler=wlc
        quiescent=yes
        protocol=tcp
------------->8---------------------------------

on the realservers:
------------->8---------------------------------
iptables -A PREROUTING -i eth0 -d ads.my.org -p tcp -m tcp --dport 80 \
            -j REDIRECT --to-ports 88
iptables -A PREROUTING -i eth0 -d www.my.org -p tcp -m tcp --dport 80 \
            -j REDIRECT --to-ports 80
iptables -A POSTROUTING -s ads.my.org -p tcp -m tcp --sport 88 \
            -j SNAT --to-source ads.my.org:80
------------->8---------------------------------

so having lighty run on port 88, bound to all interfaces does the trick

downside: ldirectord checks availability of apaches only (i.e. if
lighty on rs1 is down, requests are still redirected to it if apache
is still running; OTOH if apache is down, lighty is removed from ipvs
table as well, no matter if its running or not)

is there a more sane way to accomplish this with direct routing?

cheers m

[0] http://www.openx.org/
-- 
siggen.pl: Segmentation Fault


<Prev in Thread] Current Thread [Next in Thread>
  • [lvs-users] two VIPS on same port (w/ direct routing), Matthias Zeichmann <=