DNS Round Robin only if one goes down

domain-name-systemload balancinground-robinuptime

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.

Best Answer

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.