2

I've got two servers, equal capabilities in terms of processing power and load. What I am trying to accomplish is this: (I already own and run DNS servers so this shoudln't be a problem).

Server A will serve ALL incoming requests to sub.domain.com Server B will ONLY serve while server A is down, and if it needs to wait a few moments to decide, thats OKAY.

Is it possible? The weighted round robin doesn't work for what I need, nor does regular round robin, since it will only advance to the next server if the first request is successfully delivered.

Is there a way to make it so that if sub.domain.com on server A is unavailable, forward to server B until A comes online?

Thanks, this will really help with the consistency of my project.

U4iK_HaZe
  • 633
  • 5
  • 13

3 Answers3

6

Is there a way to make it so that if sub.domain.com on server A is unavailable, forward to server B until A comes online?

Not via DNS - at least not without a custom DNS server monitoring and changing records on the fly (which wouldn't work too well). To get this behavior, you'll need a system in between the clients and the servers handling the failover logic. HAProxy is always a good option, and assuming it's http traffic, several flavors of common web servers (Apache, nginx, lighttpd) could also do what you need.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
2

Another option is something like CARP. You assign a virtual IP address to both servers, and they ping each other periodically and as long as the 'master' is up, it will get the traffic, but if it stops responding, then the slave takes over that ip. This makes it entirely transparent to the applications.

CARP - Common Address Redundancy Protocol

Allan Jude
  • 1,286
  • 9
  • 13
2

F5 GTMs do exactly this, among other things. They do tests on devices to see if they are up, and then change the DNS records to the appropriate value.

If you're feeling particularly adventurous you could allow dynamic updates of your DNS zone. Then from host B do checks against host A using some kind of script. If it detects host A is down/unreachable/unresponsive, it can send a DNS update request to change the IP. Host A can do the inverse, and automatically set the DNS record back to its IP after a certain time of "upness".

You can also swing with the options of HAProxy, or other high availability options such as CARP, or look at the Linux-HA.org site.

Jon Angliss
  • 1,782
  • 10
  • 8