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.

I have 3 servers each running a nameserver and a webserver. Today, 2 of the servers went down. I thought the last server would handle all future requests from then on out, but that only seemed to happen a fraction of the time. Other times, requests would time out.

On each of my servers, I have zone entries with the following:

ns1          IN A        <SERVER IP 1>
ns2          IN A        <SERVER IP 2>
ns3          IN A        <SERVER IP 3>
example.com. IN A        <SERVER IP 1>
example.com. IN A        <SERVER IP 2>
example.com. IN A        <SERVER IP 3>
www          IN CNAME    example.com.

Should I just keep a single A record for example.com on each server? I want to set my servers up so that any server can transparently handle all requests if other servers go down.

share|improve this question
add comment

4 Answers

up vote 1 down vote accepted

What you have set up is DNS round robin; while this will provide load-balancing, it will not provide transparent, dynamic failover. This is because when clients query the A record 'example.com', though they will receive all 3 server IPs, they will often cache one to be used for future connections to that domain name. Even if you set your zone's TTL to be low, on the public internet, you have no control over how many caching resolvers are between you and your clients, let alone what application level caching of DNS entries may be occurring on the client machine (Internet Explorer, for example, maintains its own DNS cache).

What you are looking to engineer is high-availability. This will require either a hardware appliance, or some form of software clustering. Hardware options include Citrix Netscaler, F5 ig IP, or Foundry NetIrons. Buying your own will most likely not be practical, unless you work for a large enterprise hosting many applications. It may be worth checking with your hosting provider, as many will provide access to a shared HA appliance for an additional fee.

Software based options include Microsoft Network Load Balancing on Windows, or ucarp on Linux; without knowing your precise requirements and what your current infrastructure looks like, it's difficult to be more specific. There are several other questions on SF that may be of more help - check out the high-availability and clustering tags in particular.

share|improve this answer
add comment

What probably happened is that when 2 of the 3 went down, the third one had no knowledge of this, and continued to provide A records for the servers that had gone down. The DNS server won't preference it's own IP in the result it returns - depending on the software, it may pick in order or randomly from the A records. So, 2 out of 3 times, it will return an A record to the 2 servers that went down.

To address this entirely within DNS, you would need some kind of DNS load balancer (either on the systems, or as a 3rd party device/service).

Keeping a single A record on each DNS server would allow each to function independently, although you may end up with a huge load on the first server (relative to the other 2) in order (ie: ns1 maps to server1 and has a server1 A record in it's zone, it will most likely be the one queried first by clients, and so if it's up, it will get almost all of the traffic).

So, it would WORK, but it might not work the way you are hoping.

share|improve this answer
add comment

Do you mean primaries or resolvers?

If it's primaries, loads of people host them. For resolvers in your own infrastructure, failover is problematic as most resolver libraries will just try all the resolvers in preference order. A failed 1st resolver means that 2nd and 3rd ones will be tried, but only after a hideous long delay which will screw up performance in a big way (for things like mail servers which need to do name resolution in their critical path of execution).

So redundancy is not the only problem, but having continuously available high performance - performance cannot be allowed to drop if some resolvers fail. We use LVS to load balancer our internal resolvers now, as it has proved the only way of getting sufficient performance and redundancy for high volume name resolutions.

share|improve this answer
add comment

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.