I’m succumbing to comments and queries on whether the PowerDNS DNS name
server could be backed by a CouchDB database. It can.
I’m not going to delve too deeply into
PowerDNS here because I discuss it very thoroughly in chapter 6 of my book
Alternative DNS Servers. So, in other words, if you’re not familiar with
PowerDNS, I’ll recommend that as study material.
Faithful readers will recall, that I implemented a first DNS server with
a CouchDB database as a proof of concept. After a complete redesign of
the document model I had an implementation of a standalone authoritative DNS
server with a CouchDB backend. This third iteration I discuss here takes that
same model and the same data and creates a so-called pipe back-end for
Now, the pipe back-end is a simple shell, Perl, or whatever program which
reads queries given to it by PowerDNS from stdin and issues replies on
stdout. As such, it is a very useful back-end for prototyping.
Unfortunately, and as is to be expected, the result is not terribly fast; this
is no limitation of PowerDNS, but rather of the shuffling of data that occurs
between PowerDNS and the back-end’s program.
The pipe backend is a PowerDNS native type only; it cannot be a master or a
slave, nor does it have autoserial capability, where a serial number is
automatically incremented. Well, the good news is that this CouchDB version
has all of that:
The SOA serial number is incremented automatically when the JSON document in CouchDB is modified. (If you don’t want this to happen, add a serial field to your zone document.)
CouchDB being what it is, this backend can replicate! Master, slave, whatever you like. ;-) (But admittedly, this is not DNS data AXFR-type replication.)
I’m using the following pdns.conf:
(For testing purposes, leave the two caching values at 0 for the time being.)
The powercouch.pl program is the pipe-back-end’s program:
Note that I’m using exactly the same CouchDB database and design that I used
in the standalone version. You’ll notice that the two programs are quite
similar, the differences being in the way the standalone version replies to
Stanford::DNSserver and the PowerDNS version simply prints its results to
stdout for PowerDNS to then parse.
The result works.
It isn’t fast, but it works. You can, however, make it blindingly fast by
tuning the cache values for PowerDNS as hinted to above. Read about it