Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How I can setup something for some squid users to use another server if the primary server is down?

share|improve this question
up vote 0 down vote accepted

The easiest way to do this would be to have another squid server on the same network segment, and use heartbeat to share a virtual IP between them. Then you configure the clients to use the VIP, and when the primary server goes down it transparently fails over to the secondary, requiring no change on the user's machine at all.

If you are using Centos/redhat, it's particularly easy. Install the heartbeat package, and modify the two files /etc/ha.d/ and /etc/ha.d/haresources (assuming real IPs of and 12 for machines A and B respectively, and for the VIP):

on machine A add in

ucast eth0

node {fqdn.machine.a} node {fqdn.machine.b}

on machine B add in

ucast eth0

node {fqdn.machine.a} node {fqdn.machine.b}

in haresources on both: {fqdn.machine.a}

Now restart the heartbeat service on both, configure squid to listen on all interfaces, and you're good to go. This does not fail over if the machine stays up but squid goes down. That is a bit more complicated (though doable).

share|improve this answer
Thanks. The bad part is that the servers will not be on the same network – mazgalici May 6 '11 at 13:10

Simply running Linux heartbeat the two servers could solve that problem. You define a virtual IP address owned by the primary server, if the primary server fails the IP address fails over to the standby box (make sure you copy the configuration files across!). With heartbeat you can do checks to make sure the Squid process is running, it can access the Internet (if that is required) etc before deciding which server will become the master.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.