[lvs-users] About Post - Varnish redundancy

Victor Agustin Becerra vbecerraar at gmail.com
Wed Sep 9 22:14:13 BST 2009


Today I see that one of you are implemented well LVS active/active with
Varnish.

http://projects.linpro.no/pipermail/varnish-misc/2009-September/003044.html

I'm in the same work but... at the moment I can't make that Varnish work
using ONLY the VIP and don't the Real IP of Real Servers this is my issue at
the moment
Varnish work fine if I setup the Real IP on each Real Server, but don't work
when I set on the VIP address.

*Good:*
Real Server 2
root      7896  0.0  0.0 110716   976 ?        Ss   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.42:80 <http://174.123.226.42/> -f
/xephnet/conf/varnish/etc/ default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
varnish   7897  0.0  0.1 4515068 5048 ?        Sl   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.42:80 <http://174.123.226.42/> -f
/xephnet/conf/varnish/etc/default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
root      7899  0.0  0.0 103132  1592 ?        Ss   15:00   0:00
/usr/local/bin/varnishncsa -a -w /xephnet/conf/varnish/px-02-hou_access.log
-D -P /var/log/varnishncsa.pid

Real Server 1
root      7896  0.0  0.0 110716   976 ?        Ss   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.41:80 <http://174.123.226.41/> -f
/xephnet/conf/varnish/etc/default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
varnish   7897  0.0  0.1 4515068 5048 ?        Sl   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.41:80 <http://174.123.226.41/> -f
/xephnet/conf/varnish/etc/default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
root      7899  0.0  0.0 103132  1592 ?        Ss   15:00   0:00
/usr/local/bin/varnishncsa -a -w /xephnet/conf/varnish/px-02-hou_access.log
-D -P /var/log/varnishncsa.pid


*Bad:*
root      7896  0.0  0.0 110716   976 ?        Ss   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.45:80 <http://174.123.226.45/> -f
/xephnet/conf/varnish/etc/default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
varnish   7897  0.0  0.1 4515068 5048 ?        Sl   15:00   0:00
/usr/local/sbin/varnishd -a 174.123.226.45:80 <http://174.123.226.45/> -f
/xephnet/conf/varnish/etc/default.net.vcl -T 127.0.0.1:6069 -t 120 -w
10,1000,120 -u var
root      7899  0.0  0.0 103132  1592 ?        Ss   15:00   0:00
/usr/local/bin/varnishncsa -a -w /xephnet/conf/varnish/px-02-hou_access.log
-D -P /var/log/varnishncsa.pid


My environment is:
2 Directors (LVS/DR)
2 Real Server (+ Varnish)

* setup Linux-DR*
* *
* *Heartbeat *Master/ Director*_A
* IP address = 174.123.226.44*/28
 Gateway = *174.123.226.33*
* ** VIP = 174.123.226.45*/32 (with Ipaddr2 on haresources)

* *Heartbeat Backup */ Director*_B
* IP address = 174.123.226.43*/28
 Gateway = *174.123.226.33*
* ** VIP = 174.123.226.45*/32 (with Ipaddr2 on haresources)

* Realserver 1*
* IP Address = 174.123.226.41/28*
* Gateway = 174.123.226.33*
 lo:0 Address = *174.123.226.45*/32
* *
* Realserver 2*
* IP Address = 192.168.2.3*
* Gateway = **174.123.226.33*
 lo:0 Address = *174.123.226.45*/32
* *

Script used for LVS/DR on each Real Server.
#! /bin/sh

VIP=174.123.226.45
HOST=`uname -n`

case "$1" in
	start)
	/sbin/ifconfig lo down
	/sbin/ifconfig lo up
	echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
	echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce


	echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
	echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce
	echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
	echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce



	/sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 up
	/sbin/route add -host $VIP dev lo:0
	;;

	stop)
	/sbin/ifconfig lo:0 down
	echo 0 > /proc/sys/net/ipv4/conf/lo/arp_ignore
	echo 0 > /proc/sys/net/ipv4/conf/lo/arp_announce


	echo 0 > /proc/sys/net/ipv4/conf/eth0/arp_ignore
	echo 0 > /proc/sys/net/ipv4/conf/eth0/arp_announce
	echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore
	echo 0  > /proc/sys/net/ipv4/conf/all/arp_announce


	;;

	status)

	islothere=`/sbin/ifconfig lo:0 | grep $VIP`
	isrothere=`netstat -rn | grep "lo:0" | grep $VIP`
	if [ ! "$islothere" -o ! "isrothere" ];then
		echo "LVS-DR real server stopped."


	else
		echo "LVS-DR running."
	fi
	;;

	*)
	echo "$0: Usage: $0 {start|status|stop}" 2&>1
	exit 3
	;;
esac
exit 0

Any advice is appreciate!

Best Regards,

-- 
------
Victor Agustin Becerra


More information about the lvs-users mailing list