[Pdns-users] Incrementing SOA serials?

2012-09-11 Thread Drew Linsalata
We're putting together a small dynamic DNS auto-update system to handle
some customer cloud instances.  This is PDNS using MySQL back end with
MySQL replication between the master node and slave nodes.  Updating a
given resource record in SQL is easy, but what about updating the serial
number in the SOA for the given domain?  Our resource update SQL syntax
looks like this:

UPDATE records SET CONTENT=\$1\, CHANGE_DATE=\`date +%s`\ WHERE
name=\$2\

$1 is the new IP of the host
$2 is the host name (i.e. host.domain.com)

Works perfectly, but what about updating the serial number for the zone in
the SOA record?  In an SQL master/slave setup I can't think of a reason
that it would matter.  Any thoughts on that?
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Incrementing SOA serials?

2012-09-11 Thread Jan-Piet Mens
 Works perfectly, but what about updating the serial number for the zone in
 the SOA record?  In an SQL master/slave setup I can't think of a reason
 that it would matter.  Any thoughts on that?

I tend to agree that if you're using PowerDNS exclusively as mentioned,
you won't need to bother with the SOA serial number. However: there may
come the day when you'll want to be master for slave AXFRs, at which
time it *does* become important. I'd implement SOA serial number
updating now, before you forget ;-)

-JP
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users


Re: [Pdns-users] Incrementing SOA serials?

2012-09-11 Thread Posner, Sebastian
Jan-Piet Mens wrote:

  Works perfectly, but what about updating the serial number for 
  the zone in the SOA record?  
  In an SQL master/slave setup I can't think of a reason
  that it would matter.  Any thoughts on that?
 
 I tend to agree that if you're using PowerDNS exclusively as mentioned,
 you won't need to bother with the SOA serial number. However: there may
 come the day when you'll want to be master for slave AXFRs, at which
 time it *does* become important. I'd implement SOA serial number
 updating now, before you forget ;-)

Updating Serial keeps debugging easier; when serial is set/updated
with each zone change, it's easier to check whether all servers
really got the last update.


Personally, I go with Serial=0 in SOA and let autoserial sort it out.

OK, some tweaks applied.


- Using gmysql-backend, I moved records to records_backend; 
  changed type of change_date to timestamp with defaulting:

change_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP


- Furthermore, a trigger to completely ignore whatever is inserted 
  into change_date:

CREATE TRIGGER records_backend_timestamp BEFORE INSERT ON records_backend FOR 
EACH ROW SET NEW.change_date = CURRENT_TIMESTAMP;


- And to keep the backend working without modifying anything else, 
  something needs to look like records from original schema and 
  have INT as change_date:

CREATE VIEW `records` AS select id, domain_id, name, type, content, ttl, prio, 
unix_timestamp(`records_backend`.`change_date`) AS change_date,ordername,auth 
from `records_backend`;


As it is mysql and the view only uses one single table, it's even writeable 
(eg. for pdnssec rectify-zone).


Bam. Any thoughts on that? xD


Kind regards,

Sebastian
--
Sebastian Posner
Unix-Systemspezialist
Deutsche Telekom AG, Products  Innovation
Es hat einmal einer gesagt, das geht nicht. Dann kam einer, der wusste das 
nicht und hat es einfach gemacht
___
Pdns-users mailing list
Pdns-users@mailman.powerdns.com
http://mailman.powerdns.com/mailman/listinfo/pdns-users