Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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/ha.cf and /etc/ha.d/haresources (assuming real IPs of 1.2.3.11 and 12 for machines A and B respectively, and 1.2.3.10 for the VIP):

on machine A add in ha.cf:

ucast eth0 1.2.3.12

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

on machine B add in ha.cf:

ucast eth0 1.2.3.11

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

in haresources on both: {fqdn.machine.a} 1.2.3.10/24/eth0

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.

http://www.linux-ha.org/wiki/Main_Page

share|improve this answer

Your Answer

 
discard

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.