allwebnow
asked on
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
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
ASKER
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.
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.
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.
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.
ASKER
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
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
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
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
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.
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.
ASKER
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?
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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!
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!
I haven't personally used a service like that before as I've always worked in environments that have redundant networks/hardware setup.
ASKER
Thanks for showing me this service!
I've signed up and tested this and it will work for me in my current situation.
I've signed up and tested this and it will work for me in my current situation.
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).