[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)

Hi,

> 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:

  https://github.com/Deduktiva/pdnsutil/blob/master/zonediff


Example output:

./zonediff changeme http://127.0.0.1:8081 http://172.16.190.53:8081
I: server1: URL: http://127.0.0.1:8081, Name: local
I: server2: URL: http://172.16.190.53:8081, 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	192.168.0.4
 bill.example.org	A	86400	192.168.0.3
 ftp.example.org	CNAME	86400	www.example.org
-test.example.org	A	86400	1.1.1.4
+test.example.org	TXT	86400	1.1.1.4
 www.example.org	A	86400	192.168.0.2
diff zone 8.b.d.0.1.0.0.2.ip6.arpa on server local to server dns01
--- local/8.b.d.0.1.0.0.2.ip6.arpa
+++ dns01/8.b.d.0.1.0.0.2.ip6.arpa
@@ -10,5 +10,4 @@
 ; soa_edit_api = 
 8.b.d.0.1.0.0.2.ip6.arpa	SOA	3600	a.misconfigured.powerdns.server hostmaster.8.b.d.0.1.0.0.2.ip6.arpa 0 10800 3600 604800 3600
 8.b.d.0.1.0.0.2.ip6.arpa	NS	3600	ns1.example.com
-8.b.d.0.1.0.0.2.ip6.arpa	NS	3600	ns2.example.com
 a.a.0.0.b.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa	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	4.3.2.1
+www.example1.org	A	3600	2.3.31.4
---
I: 39 zones, 3 different, 36 identical, plus 0 errors


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










More information about the Pdns-users mailing list