DNS on CouchDB
Posted on February 28th, 2010 in CouchDB | 1 Comment »
Working a lot recently with our DNS servers which run PowerDNS. We’re using the MySQL backend and set up master-slave replication at the database level to keep all of our DNS servers in sync. A small mistake led to updating a record on one of the slaves instead of the master. The slave then was out of sync and wouldn’t replicate from the master, so the records from the secondary were stale and out of sync with the primary. Getting that MySQL slave sync’d up again, while straightforward, is a time sync and the whole idea has a wrong feeling to it.
Got to thinking about using CouchDB, instead of MySQL. A couple of features seemed to line up really nicely with DNS as a whole:
- Replication is native to Couch
- Couch’s concept of eventual consistency is sufficient for our needs
- The format of DNS Resource Records translate nicely to the concept of Couch JSON documents
- Couch’s views and RESTful API provides a flexible interface for the DNS server, future admin web apps and client web apps.
I thought the biggest roadblock would be adding a new backend to the DNS server. With a prod from Kenneth Kalmer I went looking deeper into PowerDNS and found two possible solutions. Either write a new backend in C++ or start with their PipeBackend. While the custom backend would provide speed advantages, for now we’ll keep it simple and go with a scripting language through PipeBackend.
The roadmap I’m laying out here is how I think this could work.
- Add resource records to a CouchDB database
- Configure PowerDNS to use PipeBackend
- Set up ruby-pdns which would talk to PowerDNS through PipeBackend. Rework ruby-pdns to skip loading all zone files from disk at startup. Instead, query CouchDB for the requested records from PowerDNS dynamically.
I’ll keep you updated as I progress.
One Response
Hot stuff! Get in touch if you need any help
Cheers
Jan
–