NicTool and BIND export

Started by mike_tcis, April 04, 2013, 08:34:08 PM

Previous topic - Next topic


Hi Matt,

We are looking at using NicTool for a few thousand customer zones.  Our current DNS management system (built many years ago - a simple MySQL DB with a few basic DNS record fields coupled with a Perl export script) flags each zone that is modified (with a simple "0" for no export or "1" for export-needed), and the export routine only exports out those zones into a BIND-compatible zone file.  Once it has exported the zones, it resets the "modified" flag back to "0". 

Based on what I've seen in the docs and on the forum, both the older PHP "BIND export script" provided by a forum member and your routine seem to dump ALL of the zones out when called (or on a schedule possibly) rather than only those zones that have changed since the last export.  Is this correct?  If so, is there a way to emulate the way our current system works with NicTool?




Hey Mike,

That's a great question. The "new" exports do indeed perform a full export after even a single zone change. This is partly because tinydns requires a full export. Even with that being the case, one of the first hacks I commissioned to tinydns (in 2001!) was teaching it to read from two CDB files, so I could perform incremental updates.

When I wrote the new export scripts, incremental updates were part of the design. The nt_zone table has a last_modified column. Any time a zone or zone record is modified, the TTL field in nt_zone is bumped. When that happens, the last_modified timestamp also updates. That's the mechanism by which the export scripts determine whether an export should run or not. The export finds the time that the last export completed successfully, and then checks if any zones for that NS have been modified since.

That same mechanism could be used to perform incremental updates. For BIND flat file export, only exporting the zones with changes makes perfect sense. I'd choose --incremental as a new option, and I've love to see a fork on github that contributes it. :)