Failover system

cwfie

Verified User
Joined
Aug 3, 2005
Messages
91
Hello Y'All :),

I hope someone can help me out.

Currently I have 2 servers running with DirectAdmin. This is what I want to setup (without an expensive load-balancing system):

Server 1 - main server with website
Server 2 - backup server, data is synced from server 1 (already functioning)

If have two nameservers, one running on server 1 and the other one on server 2.

If server 1 (and of course nameserver 1) goed down the DNS needs to be forwarded to server 2. Af far as I know this does work, however it depends on the Internet providers how long it will take to connect to server 2.

Do you guys have a simple solution? Maybe a VPS who can manage the DNS? If so, how would you set it up?

Thank you in advance :)
 
You can make the time delay short by having a low TTL; we use 600, which is ten minutes. If you use much lower some ISPs may ignore your TTL and use a high one of their own. This is just left-over behavior from when sending even one packet was considered expensive. There's no need for it on the modern 'net, and most ISPs no longer do it.

Unfortunately the cached DNS won't change no matter what you do; caching means that the old data is used until it expires.

It's made worse by the fact that browsers and in some cases local desktop systems, netbooks,notebooks, smart phones, routers and and the like also can cache IP#s, and may very well ignore the TTL.

All that said:

Is this scenario okay with you:

When both servers are running, then both get hits. When either server goes down only the other gets hits?

If so, then all you need to do is have each server run it's own DNS pointing to it's own machine.

Otherwise you can use your main DirectAdmin server as a hidden master to serve DNS to at lest two slave servers (perhaps small VPS boxes) and point your domains only to the slave servers. (Please don't ask about hidden masters on this forum until after you've googled and tried to understand it for yourself.)

Then write a script on your backup server to keep checking the main server, and once it determines the main server is down, to update the hidden masters with it's own IP#s. You'll still need to have a low TTL, however.

Jeff
 
You can make the time delay short by having a low TTL; we use 600, which is ten minutes. If you use much lower some ISPs may ignore your TTL and use a high one of their own. This is just left-over behavior from when sending even one packet was considered expensive. There's no need for it on the modern 'net, and most ISPs no longer do it.

Unfortunately the cached DNS won't change no matter what you do; caching means that the old data is used until it expires.

It's made worse by the fact that browsers and in some cases local desktop systems, netbooks,notebooks, smart phones, routers and and the like also can cache IP#s, and may very well ignore the TTL.

All that said:

Is this scenario okay with you:

When both servers are running, then both get hits. When either server goes down only the other gets hits?

If so, then all you need to do is have each server run it's own DNS pointing to it's own machine.

Jeff

Hello Jeff,

Thank you for your explanation.
I do not understand it exactly; when I setup two nameservers, all traffic will go to the first (name)server?

Cheers,
Steven
 
A common misconception is that all traffic goes to the first nameserver (ns1?) as long as it's up, and only to the others (ns2, etc.) if the first one isn't responding.

But that's not how DNS work. First, consider that the server replying to an NS request will return the name servers in random order; not the order in which they're listed.

Second, the user's system's resolver will try all nameservers it gets, and accept the first reply it gets, ignoring the others.

My idea gives one of your servers ns1, and the other ns2, and each points to it's own IP for the server. So the least busy server (hopefully) will respond quickest, and that user will see the IP# of that machine. When a machine goes down, it's nameserver will no longer respond, and then only the machine still running will get hits.

Of course, for anyone who already got the site's IP# from ns1 will still try to get pages from the server hosting ns1 even after it's gone down, for at least the time defined by the TTL; only new requests will be guaranteed to only go to the other server.

Jeff
 
Back
Top