[Pdns-users] Documentation on populating backend database tables

Sebastian Tennant sebyte at smolny.plus.com
Fri Apr 22 21:18:45 UTC 2011

Hi all,

Can anyone point me to some documentation on how to populate the backend
database tables (assuming you're using a relational database backend), i.e.,
what values should you use in each column, and when?

I've chosen to use sqlite3 as my backend, so my schema looks like this:

--8<---------------cut here---------------start------------->8---
 CREATE TABLE domains (
   id              INTEGER      PRIMARY KEY,
   name            VARCHAR(255) NOT NULL,
   master          VARCHAR(128) DEFAULT NULL,
   last_check      INTEGER      DEFAULT NULL,
   type            VARCHAR(6)   NOT NULL,
   notified_serial INTEGER      DEFAULT NULL,
   account         VARCHAR(40)  DEFAULT NULL );

 CREATE UNIQUE INDEX name_index ON domains(name);

 CREATE TABLE records (
   id              INTEGER      PRIMARY KEY,
   domain_id       INTEGER      DEFAULT NULL,
   name            VARCHAR(255) DEFAULT NULL,
   type            VARCHAR(6)   DEFAULT NULL,
   content         VARCHAR(255) DEFAULT NULL,
   ttl             INTEGER      DEFAULT NULL,
   prio            INTEGER      DEFAULT NULL,
   change_date     INTEGER      DEFAULT NULL );

 CREATE INDEX rec_name_index ON records(name);
 CREATE INDEX nametype_index ON records(name,type);
 CREATE INDEX domain_id ON records(domain_id);

 CREATE TABLE supermasters (
   ip              VARCHAR(25)  NOT NULL,
   nameserver      VARCHAR(255) NOT NULL,
   account         VARCHAR(40)  DEFAULT NULL );
--8<---------------cut here---------------end--------------->8---

How, for example, do I set up pdns as an authoritative name server for foo.com
and publish the addresses of two subdomains (ns1 and ns2):

My guess would be something like this:

 INSERT INTO domains (name,type) VALUES ('foo.com', ???);  
 -- what does type mean here?

 INSERT INTO records (domain_id, name, type, ttl)
   VALUES (1, '', 'NS', 259200);

 INSERT INTO records (domain_id, name, type, ttl)
   VALUES (1, 'ns1', 'A', 86400);

 INSERT INTO records (domain_id, name, type, ttl)
   VALUES (1, 'ns2', 'A', 86400);

But wait... where do the IP addresses go?

Any help/tips/advice/pointers much appreciated.

Eamcs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.

More information about the Pdns-users mailing list