dns fallback with rsync (aka poor man's redundancy)

Firstly, a little synopsis of what I'm trying to do:
I have 2 servers located separately at 2 different datacenters both with cpanel loaded and configured identically.  I will be using rsync to sync up home/user directories on server 1 to server 2 with a cron running every hour in incremental mode.  I will only be doing this with 2 or 3 fairly small websites, so I don't think bandwidth and server load will be too much of an issue, if it is we can just have it update less frequently.   Anyway, My main question is about primary and secondary dns routing and the easiest way to control which dns's machine is loaded first... consistently.

I'm using enom as my registrar and they've told me that nameserver 1,2,3, and 4 will be queried pretty much randomly.  Is there a way to control which dns's machine will in fact be loaded 1st or 2nd?  Does TTL have anything to do with this and if so, how would it be configured?  (ie. what server gets a different ttl setting and what's a preferred ttl setting for a secondary server?)  Basically I need server1 to load before server2 (always) unless (and only) if server1 is down then server2 can load automatically without downtime.

Any help would be greatly appreciated!
Thanks,
Ben
allwebnowAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ravenplCommented:
DNS servers are queried randomly (RR in fact) by the client, and You have little to say here.
Also, the client will ask second NS if first timeouts, third if second timeouted etc.
It's just the order is not the same as You have set in Your zone file (or delegation zone).
0
allwebnowAuthor Commented:
3 questions:

1. does RR mean randomly rotated?

2. what do you mean by "You have little to say here" ?
What sort of things should I be saying?  I edit dns via cpanel's dns zone and am looking for a solution on how to control which server machine loads first.  At this point it sounds like I need another layer of intellegence on both servers to route the dns accordingly regardless of what is queried at the enom registrar.  If this is the case, how does one manage to accomplish this so there is consistency in which machine1 loads 1st and machine2 loads second in case of outage of machine1?  

3. Does the cpanel dns zone area allow for this sort of intelligence to setup what dns loads before the other using setttings like Time to live (TTL).  I don't really understand dns that much but I just need to know what the best solution for this is.
0
ravenplCommented:
1. RR == round-robin

2. What You mean by "which server machine loads first"? Loaded with dns queries to hosted zone? If so, then resolver (client) will ask all auth nameservers (NS records) randomly(or as I noted before in RR fashion).

3. I don't know. But since it's randomized, no point in such setting.

if the resolver wants to get IP for www.a.tld, it first asks for auth nameservers list the a.tld domain nameserver(root nameserver in general). The received list is randomized by replying nameserver(linux's bind does it in RR fashion). Having the list, resolver asks first ns, if it fails, the second and so on.
Same applies to IPs returned for given name(one name can report many IPs)
This is commonly used to implement poor mans load balancing via DNS.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

allwebnowAuthor Commented:
2. What You mean by "which server machine loads first"? Loaded with dns queries to hosted zone? If so, then resolver (client) will ask all auth nameservers (NS records) randomly(or as I noted before in RR fashion).
I have a main server my datacenter and a vps at the other datacenter.  The vps is slower which I don't want as my primary server machine for my customers.  Therefore, i want the dns to propogate to the 1st machine always which is the main server that is faster and better at all times...only if this 1st server goes down, I then want the second vps server to take over.

So, is Round Robin alreay setup on linux by default?  meaning is rr a standard dns resolving process that linux uses, or is RRs something I can setup or tweak to work the way I want it to work?
I've attached a layout of what I need.
JUST-2-server---2dc-dns-wit.gif
0
ravenplCommented:
The real problem is the registrar (enom). That's who responses to queries "where are nameservers for domain server.com?" I doubt You will convince them to prioritize responces in any way.

BTW: to verify the order of nameservers simply run few times under any Unix like system, look at the nameservers order
host -t ns yourdomain.com
0
TintinCommented:
In your situation, using DNS for failover isn't going to work very well (that's not what it's designed for).

Ideally, you'd have a load balancing switch (hardware or software based) in front of your servers that handles the failover for you.

However, I'm assuming that's not feasible, so the next best thing to do is setup a VIP (Virtual IP address) and point your DNS to the VIP.

The way it would work is that server1 would have the active VIP and server2 would poll the VIP at regular intervals to see if it was still up.  In the event server1 dies and/or the VIP is unavailable, server2 would activate the VIP.  When server1 comes back up, it would need to ensure it doesn't configure the VIP if server2 has it configured.

Note that the above assumes the two servers are in the same subnet.
0
allwebnowAuthor Commented:
Quote:
In your situation, using DNS for failover isn't going to work very well (that's not what it's designed for).

WHat's the reason for having primary and secondary nameservers at the registrar then?  I thought that's what that was for.

Quote:
Ideally, you'd have a load balancing switch (hardware or software based) in front of your servers that handles the failover for you.

These servers are in 2 different datacenters.  Would a load balancer work in 2 different locations?  Also, i don't know if I really want loadbalancing so much as I need a complete failover solution in case of an all out outage of server1.  Our datacenter went down 3 times last year and there was nothing we could do about it.  This is why I'm trying to figure this out so if datacenter1 goes down, the little vps in datacenter2 can save the day.   Maybe I could propogate server1 and server2 nameservers at the registrar and then turn off mysql, apache, and exim on server2, and if there is an issue with server1, manually turn on all these services on server2?  Maybe something like that would work.  That way server1 data is always loaded no matter what dns is queried 1st, and if it ever went down, I can just turn on server2 web services.  Or even find a way to automate that at some point.  I would still need bind on though so rsync could countinue to work.  Do you know if this would be a plausible solution or not?

quote:
The way it would work is that server1 would have the active VIP and server2 would poll the VIP at regular intervals to see if it was still up.  In the event server1 dies and/or the VIP is unavailable, server2 would activate the VIP.  When server1 comes back up, it would need to ensure it doesn't configure the VIP if server2 has it configured.

Note that the above assumes the two servers are in the same subnet.

Since the servers are at 2 different datacenters I don't beleive they're under the same subnet.  Is that possible?  If this could work between 2 datacenters, is there documentation to set this up?
0
TintinCommented:
The purpose of primary and secondary  name servers is to ensure that DNS requests are still served in the event that one of the name servers goes down.

If your servers are in different data centers, they will almost certainly be on different subnets, in which case your VIP would need to exist on another device (router, switch, load balancer).

What sort of downtime can you afford to live with?  If you are happy about just minimising the downtime rather than having 99.99% uptime, then if you set a very low TTL on your DNS record, you can manually change the server the DNS points to in the event the first server is down/unavailable.  This certainly isn't a foolproof solution, but it's better than nothing.

On the back of that, you could use a service like http://www.dnsmadeeasy.com/s0306/prod/dnsfosm.html 


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
allwebnowAuthor Commented:
Quote:

On the back of that, you could use a service like http://www.dnsmadeeasy.com/s0306/prod/dnsfosm.html 

Have you used this service  before or know someone who has?  This might be my only real solution for this based on what I read at their website.  Thank you very much for the link!  
0
TintinCommented:
I haven't personally used a service like that before as I've always worked in environments that have redundant networks/hardware setup.
0
allwebnowAuthor Commented:
Thanks for showing me this service!
I've signed up and tested this and it will work for me in my current situation.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.