0

I have twp name servers running PowerDNS as ns1 and ns2 using a master/slave-type setup, and this works well. I want to create multiple servers to provide services (i.e. web, email, etc), then have PowerDNS on either ns1 or ns2 (whichever is hit) return one of several IPs associated with a host name depending on whether that host is actually up and running.

For instance, let's say that I have two web servers, X and Y. I then have two A records in DNS so that webserver.local sometimes resolves to X's IP and sometimes to Y's IP, resulting in a round-robin effect. Perfect.

Now if X goes down, this will still work, but the client will have to time out before they get a chance to hit Y, which means that ultimately they'll get to where they want to go, but just much more slowly. If X goes down, I'd like it's IP address to be removed from the round-robin list of IPs to resolve to so that DNS would only be returning Y's IP when resolving webserver.local, until such time that X is repaired and put back into service.

Asking PowerDNS to verify that the host is up and running on each request could take a second or two (if it's even possible), which would really slow down DNS queries. One thought I've had would be to have a completely separate task periodically through cron check the servers, and modify the PowerDNS configs accordingly. I can certainly attack it from this perspective, but was hoping there might be a more standard way of approaching this that wouldn't require as much custom development.

Nick Coons
  • 345
  • 4
  • 16
  • DNS updates always have latency because of caching in many places. Therefore I would approach this problem using virtual IPs and cluster management software, which would assign the virtual IP to a live node. – Tero Kilkanen Nov 14 '14 at 11:00
  • @TeroKilkanen, wouldn't that eliminate my ability to do the above-described round-robin setup then? – Nick Coons Nov 14 '14 at 15:53
  • Yeah, you would need a load balancer to achieve this. If latency doesn't matter for you (few minutes unreachability), then you can set up a script that edits PowerDNS zone information and tells PowerDNS to reload its databases. – Tero Kilkanen Nov 14 '14 at 16:01
  • Why not load balance the web servers, like people that need high availability would normally do? – joeqwerty Nov 14 '14 at 18:35
  • @TeroKilkanen, You're right, I can write a script to do that.. I just wasn't sure if there was a built-in way to handle it that wouldn't require to me to build a script. – Nick Coons Nov 15 '14 at 01:08
  • @joeqwerty, that is what I'm doing, as I described in my question. With the load balancing, requests go to either server X or server Y, and this is fine. But if server X goes down, any requests going to X go unanswered until the timeout is reached. Eventually the request will be answered by Y, but only after the client has experienced massive amount of timeout, which will persist until server X is back up. Which takes us back to my question. :-) – Nick Coons Nov 15 '14 at 01:09
  • joeqwerty meant load balancing with an actual load balancer. With that, there won't be practically any connection attempts to the failed node. While with DNS, there will always be connection attempts to the failed node, because of A record TTL. – Tero Kilkanen Nov 15 '14 at 01:59
  • @TeroKilkanen, I'm not worried about the few seconds (I set my TTL very low) of downtime during the transition. I'm trying to eliminate single points of failure. I'm not sure what you mean by "actual load balancer", but it sounds like a single point of failure. If the load balancer goes down, the fact that my servers behind it are up and running becomes meaningless and my service goes down, right? – Nick Coons Nov 15 '14 at 02:37

1 Answers1

0

Unable to determine that this was something built into PowerDNS or that there was a more "official" way to handle this, I took the route of building my own program to do this. The program is more of a general "if the host goes down, take a user-defined action" rather than specifically for this so that it has broader applications.

I've made it publicly available in case it's of use to anyone else: https://github.com/hyperionworks/pulse/

Nick Coons
  • 345
  • 4
  • 16