Varnish Clustering

Michael Alger varnish at
Fri Oct 15 07:42:18 CEST 2010

On Thu, Oct 14, 2010 at 12:25:34PM -0400, Ruslan Sivak wrote:
> Is there any sort of clustering support in varnish?  The only thing I
> found was, Varnish
> Administration Console (only for customers with service agrement).  Is
> that still true?  Do you need a service agreement to use this?  Also
> it states on another page that this is not production ready yet.

I use Linux-HA with Varnish without any problems to implement an
active/passive proxy. I store the Varnish configuration in a subversion
repository, and have a simple preprocessor script to rewrite IP
addresses and omit sections so I can use the same configuration file for
UAT as well as our production and DR environments. Generally speaking, I
make changes to the config in UAT, test them out, then check the changes
into subversion and check them out on the production servers, then
finally apply them to the actual running Varnish instance.

I have Varnish running continually on both nodes in the cluster, and the
IP addresses the sites are served from are assigned to a 10.x network
with addresses bound to loopback. The router routes this 10.x network
via an IP address which is managed by Linux-HA, i.e. whichever ever node
has that IP address configured becomes the active proxy.

Then I have a little script running continuously on each Varnish node
which makes requests via the local proxy and sets the node's score
appropriately. Whichever proxy is working the best wins, with a bias to
prevent needless flip-flopping.

You could also have the Varnish instance managed by Linux-HA, so it
would only be running on the active cluster member. I like having it
always running to reduce switchover delays, and so I can perform testing
on an identical configuration which isn't receiving live traffic.

More information about the varnish-misc mailing list