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

I am new to web based apps.. my requirement is that a user accesses a URL that can be served by two servers- Primary and Secondary.

When Primary goes down,the requests of that URL should automatically be forwarded to the secondary server so now it serves in place of the Primary (and as soon as Primary resumes,it becomes the server for all incoming requests again). How can this be achieved?? Is there going to be a script that is going to serve the purpose for me?? and where is this script going to be run?

What approach shall i take.. please share some inputs..


share|improve this question

What operating system are you using?

Two common ways of doing this are with load balancers and with clusters.

The most drop-in method would be to place a hardware load balancer in front of the web servers. The LB would detect when service is down on a node, and redirect traffic to the other node. There are also many methods of software HA/load balancing.

With clusters, the servers have heartbeat connections and other methods of detecting service availability. In an active/passive cluster, as you seem to be talking about, one server would be the active node, and if it failed, the other server would take over services. There is no need for IP changes because the cluster uses one virtual IP for external availability.

Here is an SF question related to doing this stuff with Apache/Linux.

share|improve this answer
thanks... i have been told to write a script to do all this.. is this possible with a single script?? by your approach it seems this is not as simple as it sounds.. and the m/c on which the script should run is windows so i was thinking of doing this with python.. – ashishsony Jan 27 '10 at 7:13
In theory, you could write some sort of script that ran on the passive node, and constantly checked the other server for availability, then started web services if it went down. The thing is, though, you'd also need to change routing so that requests went to it...and you'd need to differentiate between the server being wholesale down, or just an issue with web services, etc, because that would affect what the script should do. Once you do all that, well, you're halfway to implementing your own version of load balancing/ why not use an existing solution? – phoebus Jan 27 '10 at 7:18
I went ahead and added LB / HA tags to the question. – phoebus Jan 27 '10 at 7:23
@phoebus "script that ran on the passive node" means like running on the machine where the addresses are the DNS?? Can a script running on the m/c where the address names are resolved do the trick?-- Thanks.. – ashishsony Feb 1 '10 at 8:57
my simple requirement is that i need to switch the target server depending upon availbility.. i need no LB/HA.. i dont know the approach how to write the script.. where this script would be running and what should i do in the script to achieve what i want.. the dns is supposed to be running on a windows m/c.. the soln needs to be windows i believe python is the way to go. but im missing the approach.. please hlp.. Thanks. – ashishsony Feb 1 '10 at 9:20

DNS failover can be useful in some limited number of cases. See

share|improve this answer
I always say that if DNS failover and/or RRDNS is fast and reliable enough for your availability, then you might as well just make your failover plan "take the server down and fix it". ;) – phoebus Jan 27 '10 at 7:39

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.