[Pdns-users] Easiest way to compare two PowerDNS MYSQL zones (or whole databases)

Jordan Rieger jordan at webnames.ca
Sat May 9 00:08:58 UTC 2015

Very nice! Did you write that just for me?? Or was it floating around your company and you just posted it today? The GitHub archive says only 1 commit :)

-----Original Message-----
From: Christian Hofstaedtler [mailto:christian.hofstaedtler at deduktiva.com] 
Sent: Friday, May 08, 2015 4:27 PM
To: Jordan Rieger
Cc: pdns-users at mailman.powerdns.com
Subject: Re: [Pdns-users] Easiest way to compare two PowerDNS MYSQL zones (or whole databases)


> On 08 May 2015, at 02:07, Jordan Rieger <jordan at webnames.ca> wrote:
> What do you guys think would be the best approach for comparing two PowerDNS MYSQL databases that are supposed to hold the same domains and records? I want to produce a list of discrepancies between the two databases, e.g. domains missing from one but not the other, records missing from one but not the other, etc.
> Do you know of a tool or API command that would make this easier? 
> (Other than a generic database data comparison tool.)

Using the API this is basically "a small matter of programming".

You can find a small script (which can happily serve as a demonstration of the API, too), here:


Example output:

./zonediff changeme
I: server1: URL:, Name: local
I: server2: URL:, Name: dns01
W: Zones missing from dns01: test-24231446052119.org diff zone example.org on server local to server dns01
--- local/example.org
+++ dns01/example.org
@@ -16,5 +16,5 @@
 fred.example.org	A	86400
 bill.example.org	A	86400
 ftp.example.org	CNAME	86400	www.example.org
-test.example.org	A	86400
+test.example.org	TXT	86400
 www.example.org	A	86400
diff zone 8.b.d. on server local to server dns01
--- local/8.b.d.
+++ dns01/8.b.d.
@@ -10,5 +10,4 @@
 ; soa_edit_api = 
 8.b.d.	SOA	3600	a.misconfigured.powerdns.server hostmaster.8.b.d. 0 10800 3600 604800 3600
 8.b.d.	NS	3600	ns1.example.com
-8.b.d.	NS	3600	ns2.example.com
 a.a.0.0.b.b.	PTR	3600	test-24231246750228.org
diff zone example1.org on server local to server dns01
--- local/example1.org
+++ dns01/example1.org
@@ -11,4 +11,4 @@
 example1.org	SOA	3600	a.misconfigured.powerdns.server hostmaster.example1.org 0 10800 3600 604800 3600
 example1.org	NS	3600	ns1.example.org
 example1.org	NS	3600	ns2.example.org
-www.example1.org	A	3600
+www.example1.org	A	3600
I: 39 zones, 3 different, 36 identical, plus 0 errors

Christian Hofstaedtler / Deduktiva GmbH (FN 418592 b, HG Wien) www.deduktiva.com / +43 1 353 1707

More information about the Pdns-users mailing list