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.

  • 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 1:08

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/

  • 1
    This is the right approach! - Peter van Dijk, PowerDNS developer – Habbie Dec 22 '14 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.