As of 1.99.8 this is not for the feint of heart, but please test and let us know on the mailinglists how you fare! Currently this is only working reasonably well for the PostgreSQL backend. To test, issue the following on a clean database:
create table domains ( id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, master VARCHAR(20) NOT NULL, last_check INT DEFAULT NULL, type VARCHAR(6) NOT NULL ); CREATE INDEX name_index ON domains(name); GRANT UPDATE ON domains TO pdns; GRANT SELECT ON domains_id_seq TO pdns; CREATE TABLE records ( id SERIAL PRIMARY KEY, domain_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(6) DEFAULT NULL, content VARCHAR(255) DEFAULT NULL, ttl INT DEFAULT NULL, prio INT DEFAULT NULL, change_data INT DEFAULT NULL, CONSTRAINT domain_exists FOREIGN KEY(domain_id) REFERENCES domains(id) ON DELETE CASCADE ); CREATE INDEX name_index ON records(name); CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id); GRANT ALL ON records TO pdns; GRANT ALL ON records_id_seq TO pdns;Now launch PDNS with the slave option in pdns.conf. It should launch normally and report that 'All slave domains are fresh'.
Now connect to your database as user pdns. To become a slave of the 'powerdns.com' domain, execute this:
insert into domains (name,master,type) values ('powerdns.com','213.244.168.217','SLAVE');And wait awhile for PDNS to pick up the addition - which happens within one minute. Typical output is:
Apr 09 13:34:29 All slave domains are fresh Apr 09 13:35:29 1 slave domain needs checking Apr 09 13:35:29 Domain powerdns.com is stale, master serial 1, our serial 0 Apr 09 13:35:30 [gPgSQLBackend] Connecting to database with connect string 'dbname=pdns user=pdns' Apr 09 13:35:30 AXFR started for 'powerdns.com' unknown datatype in answer: 28 Apr 09 13:35:30 AXFR done for 'powerdns.com' Apr 09 13:35:30 [gPgSQLBackend] Closing connectionNote the 'unknown datatype in answer' - the secondary code does not yet know how to handle AAAA.
To reiterate, as of 1.99.8 this is not yet a mature and stable feature! The *really* adventurous may even find that this also works with the bind backend, to some extent.
On launch, PDNS requests from all backends a list of domains which have not been checked recently for changes. This should happen every refresh seconds, as specified in the SOA record. All domains that are unfresh are then checked for changes over at their master. If the SOA there is higher, the domain is retrieved and inserted into the database. In any case, after the check the domain is declared 'unstale', and will only be checked again after refresh seconds have passed.
PDNS also reacts to notifies by immediately checking if the zone has updated and if so, retransfering it.
All backends which implement this feature must make sure that they can handle transactions so as to not leave the zone in a half updated state. MySQL configured with either BerkeleyDB or InnoDB meets this requirement, as do PostgreSQL and Oracle. The Bindbackend implements transaction semantics by renaming files if and only if they have been retrieved completely and parsed correctly.