/pdns-expanded.html
/dnsdist.1
/html-new
+/doc-build
manpages: dnsdist.1 pdns_recursor.1 rec_control.1 dnstcpbench.1
-html-new:
+html-new/index.html: markdown/** mkdocs.yml
rm -rf html-new
mkdir html-new
-
-html-new/index.html: html-new markdown/** mkdocs.yml
+ rm -rf doc-build
+ mkdir doc-build
+ rsync -a --delete markdown/. doc-build/.
+ ./process-md.sh
mkdocs build
html/index.html: pdns-expanded.xml
The default setup conforms to the following schema:
-```
-CREATE TABLE domains (
- id INT AUTO_INCREMENT,
- name VARCHAR(255) NOT NULL,
- master VARCHAR(128) DEFAULT NULL,
- last_check INT DEFAULT NULL,
- type VARCHAR(6) NOT NULL,
- notified_serial INT DEFAULT NULL,
- account VARCHAR(40) DEFAULT NULL,
- PRIMARY KEY (id)
-) Engine=InnoDB;
-
-CREATE UNIQUE INDEX name_index ON domains(name);
-
-CREATE TABLE records (
- id INT AUTO_INCREMENT,
- domain_id INT DEFAULT NULL,
- name VARCHAR(255) DEFAULT NULL,
- type VARCHAR(10) DEFAULT NULL,
- content VARCHAR(64000) DEFAULT NULL,
- ttl INT DEFAULT NULL,
- prio INT DEFAULT NULL,
- change_date INT DEFAULT NULL,
- disabled TINYINT(1) DEFAULT 0,
- ordername VARCHAR(255) BINARY DEFAULT NULL,
- auth TINYINT(1) DEFAULT 1,
- PRIMARY KEY (id)
-) Engine=InnoDB;
-
-CREATE INDEX nametype_index ON records(name,type);
-CREATE INDEX domain_id ON records(domain_id);
-CREATE INDEX recordorder ON records (domain_id, ordername);
-
-
-CREATE TABLE supermasters (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- PRIMARY KEY (ip, nameserver)
-) Engine=InnoDB;
-
-
-CREATE TABLE comments (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) NOT NULL,
- comment VARCHAR(64000) NOT NULL,
- PRIMARY KEY (id)
-) Engine=InnoDB;
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
-
-
-CREATE TABLE domainmetadata (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- kind VARCHAR(32),
- content TEXT,
- PRIMARY KEY (id)
-) Engine=InnoDB;
-
-CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
-
-
-CREATE TABLE cryptokeys (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- flags INT NOT NULL,
- active BOOL,
- content TEXT,
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id INT AUTO_INCREMENT,
- name VARCHAR(255),
- algorithm VARCHAR(50),
- secret VARCHAR(255),
- PRIMARY KEY (id)
-) Engine=InnoDB;
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
+```{include=../../modules/gmysqlbackend/schema.mysql.sql}
```
`zone2sql` with the `--gmysql` flag also assumes this layout is in place.
The default setup conforms to the following schema, which you should add to a PostgreSQL database.
-```
-CREATE TABLE domains (
- id SERIAL PRIMARY KEY,
- name VARCHAR(255) NOT NULL,
- master VARCHAR(128) DEFAULT NULL,
- last_check INT DEFAULT NULL,
- type VARCHAR(6) NOT NULL,
- notified_serial INT DEFAULT NULL,
- account VARCHAR(40) DEFAULT NULL,
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE UNIQUE INDEX name_index ON domains(name);
-
-
-CREATE TABLE records (
- id SERIAL PRIMARY KEY,
- domain_id INT DEFAULT NULL,
- name VARCHAR(255) DEFAULT NULL,
- type VARCHAR(10) DEFAULT NULL,
- content VARCHAR(65535) DEFAULT NULL,
- ttl INT DEFAULT NULL,
- prio INT DEFAULT NULL,
- change_date INT DEFAULT NULL,
- disabled BOOL DEFAULT 'f',
- ordername VARCHAR(255),
- auth BOOL DEFAULT 't',
- CONSTRAINT domain_exists
- FOREIGN KEY(domain_id) REFERENCES domains(id)
- ON DELETE CASCADE,
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-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 INDEX recordorder ON records (domain_id, ordername text_pattern_ops);
-
-
-CREATE TABLE supermasters (
- ip INET NOT NULL,
- nameserver VARCHAR(255) NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- PRIMARY KEY(ip, nameserver)
-);
-
-
-CREATE TABLE comments (
- id SERIAL PRIMARY KEY,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL,
- CONSTRAINT domain_exists
- FOREIGN KEY(domain_id) REFERENCES domains(id)
- ON DELETE CASCADE,
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
-
-
-CREATE TABLE domainmetadata (
- id SERIAL PRIMARY KEY,
- domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
- kind VARCHAR(32),
- content TEXT
-);
-
-CREATE INDEX domainidmetaindex ON domainmetadata(domain_id);
-
-
-CREATE TABLE cryptokeys (
- id SERIAL PRIMARY KEY,
- domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
- flags INT NOT NULL,
- active BOOL,
- content TEXT
-);
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id SERIAL PRIMARY KEY,
- name VARCHAR(255),
- algorithm VARCHAR(50),
- secret VARCHAR(255),
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
+```{include=../../modules/gpgsqlbackend/schema.pgsql.sql}
```
`zone2sql` with the `--gpgsql` flag also assumes this layout is in place.
With PostgreSQL, you may have to run `createdb powerdns` first and then connect to that database with `psql powerdns`, and feed it the schema above.
# Oracle specifics
-
Generic Oracle support is only available since version 2.9.18. The default setup conforms to the following schema, which you should add to an Oracle database. You may need or want to add `namespace` statements.
-```
-CREATE TABLE domains (
- id INTEGER NOT NULL,
- name VARCHAR2(255) NOT NULL,
- master VARCHAR2(128) DEFAULT NULL,
- last_check INTEGER DEFAULT NULL,
- type VARCHAR2(6) NOT NULL,
- notified_serial NUMBER(10,0) DEFAULT NULL,
- account VARCHAR2(40) DEFAULT NULL,
- PRIMARY KEY (id)
-);
-
-CREATE SEQUENCE domains_id_sequence;
-CREATE INDEX domains$name ON domains (name);
-
-
-CREATE TABLE records (
- id INTEGER NOT NULL,
- domain_id INTEGER DEFAULT NULL REFERENCES domains (id) ON DELETE CASCADE,
- name VARCHAR2(255) DEFAULT NULL,
- type VARCHAR2(10) DEFAULT NULL,
- content VARCHAR2(4000) DEFAULT NULL,
- ttl INTEGER DEFAULT NULL,
- prio INTEGER DEFAULT NULL,
- change_date INTEGER DEFAULT NULL,
- disabled NUMBER(1,0) DEFAULT 0 NOT NULL,
- ordername VARCHAR2(255) DEFAULT NULL,
- auth NUMBER(1,0) DEFAULT 1 NOT NULL,
- PRIMARY KEY (id)
-) pctfree 40;
-
-CREATE SEQUENCE records_id_sequence;
-CREATE INDEX records$nametype ON records (name, type);
-CREATE INDEX records$domain_id ON records (domain_id);
-CREATE INDEX records$recordorder ON records (domain_id, ordername);
-
-
-CREATE TABLE supermasters (
- ip VARCHAR2(64) NOT NULL,
- nameserver VARCHAR2(255) NOT NULL,
- account VARCHAR2(40) DEFAULT NULL,
- PRIMARY KEY (ip, nameserver)
-);
-
-
-CREATE TABLE comments (
- id INTEGER NOT NULL,
- domain_id INTEGER NOT NULL REFERENCES domains (id) ON DELETE CASCADE,
- name VARCHAR2(255) NOT NULL,
- type VARCHAR2(10) NOT NULL,
- modified_at INTEGER NOT NULL,
- account VARCHAR2(40) NOT NULL,
- "comment" VARCHAR2(4000) NOT NULL
-);
-CREATE SEQUENCE comments_id_sequence;
-CREATE INDEX comments$nametype ON comments (name, type);
-CREATE INDEX comments$domain_id ON comments (domain_id);
-CREATE INDEX comments$order ON comments (domain_id, modified_at);
-
-
-CREATE TABLE domainmetadata (
- id INTEGER NOT NULL,
- domain_id INTEGER NOT NULL,
- kind VARCHAR2(32),
- content VARCHAR2(4000),
- PRIMARY KEY (id)
-);
-
-CREATE SEQUENCE domainmetadata_id_sequence;
-CREATE INDEX domainmetadata$domain_id ON domainmetadata (domain_id);
-
-
-CREATE TABLE cryptokeys (
- id INTEGER NOT NULL,
- domain_id INTEGER NOT NULL,
- flags INTEGER NOT NULL,
- active INTEGER NOT NULL,
- content VARCHAR2(4000),
- PRIMARY KEY (id)
-);
-
-CREATE SEQUENCE cryptokeys_id_sequence;
-CREATE INDEX cryptokeys$domain_id ON cryptokeys (domain_id);
-
-
-CREATE TABLE tsigkeys (
- id INTEGER NOT NULL,
- name VARCHAR2(255),
- algorithm VARCHAR2(50),
- secret VARCHAR2(255),
- PRIMARY KEY (id)
-);
-
-CREATE SEQUENCE tsigkeys_id_sequence;
-CREATE UNIQUE INDEX tsigkeys$namealgo ON tsigkeys (name, algorithm);
+```{include=../../modules/gpgsqlbackend/schema.pgsql.sql}
```
This schema contains all elements needed for master, slave and superslave operation.
## Setting up the database
Before you can use this backend you first have to set it up and fill it with data. The default setup conforms to the following schema:
-```
-CREATE TABLE domains (
- id INTEGER PRIMARY KEY,
- name VARCHAR(255) NOT NULL COLLATE NOCASE,
- 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(10) DEFAULT NULL,
- content VARCHAR(65535) DEFAULT NULL,
- ttl INTEGER DEFAULT NULL,
- prio INTEGER DEFAULT NULL,
- change_date INTEGER DEFAULT NULL,
- disabled BOOLEAN DEFAULT 0,
- ordername VARCHAR(255),
- auth BOOL DEFAULT 1
-);
-
-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 INDEX orderindex ON records(ordername);
-
-
-CREATE TABLE supermasters (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL COLLATE NOCASE,
- account VARCHAR(40) DEFAULT NULL
-);
-
-CREATE UNIQUE INDEX ip_nameserver_pk ON supermasters(ip, nameserver);
-
-
-CREATE TABLE comments (
- id INTEGER PRIMARY KEY,
- domain_id INTEGER NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL
-);
-
-CREATE INDEX comments_domain_id_index ON comments (domain_id);
-CREATE INDEX comments_nametype_index ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
-
-
-CREATE TABLE domainmetadata (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- kind VARCHAR(32) COLLATE NOCASE,
- content TEXT
-);
-
-CREATE INDEX domainmetaidindex ON domainmetadata(domain_id);
-
-
-CREATE TABLE cryptokeys (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- flags INT NOT NULL,
- active BOOL,
- content TEXT
-);
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id INTEGER PRIMARY KEY,
- name VARCHAR(255) COLLATE NOCASE,
- algorithm VARCHAR(50) COLLATE NOCASE,
- secret VARCHAR(255)
-);
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
+```{include=../../modules/gsqlite3backend/schema.sqlite3.sql}
```
This schema contains all elements needed for master, slave and superslave operation.
For api-versions 1 and 2, the two new fields fall back to default values. The default value for scopebits is 0. The default for auth is 1 (meaning authoritative).
## Sample perl backend
-```
-#!/usr/bin/perl -w
-# sample PowerDNS Coprocess backend
-#
-
-use strict;
-
-$|=1; # no buffering
-
-my $line=<>;
-chomp($line);
-
-unless($line eq "HELO\t1") {
- print "FAIL\n";
- print STDERR "Received '$line'\n";
- <>;
- exit;
-}
-print "OK Sample backend firing up\n"; # print our banner
-
-while(<>)
-{
- print STDERR "$$ Received: $_";
- chomp();
- my @arr=split(/\t/);
- if(@arr<6) {
- print "LOG PowerDNS sent unparseable line\n";
- print "FAIL\n";
- next;
- }
-
- my ($type,$qname,$qclass,$qtype,$id,$ip)=split(/\t/);
-
- if(($qtype eq "SOA" || $qtype eq "ANY") && $qname eq "example.com") {
- print STDERR "$$ Sent SOA records\n";
- print "DATA $qname $qclass SOA 3600 -1 ahu.example.com ns1.example.com 2008080300 1800 3600 604800 3600\n";
- }
- if(($qtype eq "NS" || $qtype eq "ANY") && $qname eq "example.com") {
- print STDERR "$$ Sent NS records\n";
- print "DATA $qname $qclass NS 3600 -1 ns1.example.com\n";
- print "DATA $qname $qclass NS 3600 -1 ns2.example.com\n";
- }
- if(($qtype eq "TXT" || $qtype eq "ANY") && $qname eq "example.com") {
- print STDERR "$$ Sent NS records\n";
- print "DATA $qname $qclass TXT 3600 -1 \"hallo allemaal!\"\n";
- }
- if(($qtype eq "A" || $qtype eq "ANY") && $qname eq "webserver.example.com") {
- print STDERR "$$ Sent A records\n";
- print "DATA $qname $qclass A 3600 -1 1.2.3.4\n";
- print "DATA $qname $qclass A 3600 -1 1.2.3.5\n";
- print "DATA $qname $qclass A 3600 -1 1.2.3.6\n";
- }
- elsif(($qtype eq "CNAME" || $qtype eq "ANY") && $qname eq "www.example.com") {
- print STDERR "$$ Sent CNAME records\n";
- print "DATA $qname $qclass CNAME 3600 -1 webserver.example.com\n";
- }
- elsif($qtype eq "MBOXFW") {
- print STDERR "$$ Sent MBOXFW records\n";
- print "DATA $qname $qclass MBOXFW 3600 -1 powerdns\@example.com\n";
- }
-
-
- print STDERR "$$ End of data\n";
- print "END\n";
-}
+```{include=../../modules/pipebackend/backend.pl}
```
## From source
See the [Compiling PowerDNS](../appendix/compiling-powerdns.md) chapter
+# Basic setup: configuring database connectivity
+This chapter shows you how to configure the Generic MySQL backend, which we like a lot. But feel free to use any of the myriad other backends. This backend is called 'gmysql', and needs to be configured in `pdns.conf`. Add the following lines, adjusted for your local setup:
+
+```
+ launch=gmysql
+ gmysql-host=127.0.0.1
+ gmysql-user=root
+ gmysql-dbname=pdns
+ gmysql-password=mysecretpassword
+```
+
+Remove any earlier [`launch`](settings.md#launch) statements. Also remove the **bind-example-zones** statement as the **bind** module is no longer launched.
+
+**Warning**: Make sure that you can actually resolve the hostname of your database without accessing the database! It is advised to supply an IP address here to prevent chicken/egg problems!
+
+**Warning**: Be very very sure that you configure the \*g\*mysql backend and not the mysql backend. See the [Generic MySQL and PostGresql Backends](backend-generic-mypgsql.md). If you use the 'mysql' backend things will only appear to work. (The 'mysql' backend was removed in version 3.1).
+
+Now start PDNS using the monitor command:
+
+```
+ # /etc/init.d/pdns monitor
+ (...)
+ 15:31:30 About to create 3 backend threads
+ 15:31:30 [gMySQLbackend] Failed to connect to database: Error: Unknown database 'pdns'
+ 15:31:30 [gMySQLbackend] Failed to connect to database: Error: Unknown database 'pdns'
+ 15:31:30 [gMySQLbackend] Failed to connect to database: Error: Unknown database 'pdns'
+
+```
+
+This is as to be expected - we did not yet add anything to MySQL for PDNS to read from. At this point you may also see other errors which indicate that PDNS either could not find your MySQL server or was unable to connect to it. Fix these before proceeding.
+
+General MySQL knowledge is assumed in this chapter, please do not interpret these commands as DBA advice!
+
+## Example: configuring MySQL
+Connect to MySQL as a user with sufficient privileges and issue the following commands:
+
+``` {include=../../modules/gmysqlbackend/schema.mysql.sql}
+```
+
+Now we have a database and an empty table. PDNS should now be able to launch in monitor mode and display no errors:
+
+```
+ # /etc/init.d/pdns monitor
+ (...)
+ 15:31:30 PowerDNS 1.99.0 (Mar 12 2002, 15:00:28) starting up
+ 15:31:30 About to create 3 backend threads
+ 15:39:55 [gMySQLbackend] MySQL connection succeeded
+ 15:39:55 [gMySQLbackend] MySQL connection succeeded
+ 15:39:55 [gMySQLbackend] MySQL connection succeeded
+```
+
+A sample query sent to the database should now return quickly without data:
+
+```
+ $ host www.example.com 127.0.0.1
+ www.example.com A record currently not present at localhost
+```
+
+And indeed, the control console now shows:
+
+```
+ Mar 12 15:41:12 We're not authoritative for 'www.example.com', sending unauth normal response
+```
+
+Now we need to add some records to our database:
+
+```
+# mysql pdnstest
+mysql> INSERT INTO domains (name, type) values ('example.com', 'NATIVE');
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'example.com','localhost ahu@ds9a.nl 1','SOA',86400,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'example.com','dns-us1.powerdns.net','NS',86400,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'example.com','dns-eu1.powerdns.net','NS',86400,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'www.example.com','192.0.2.10','A',120,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'mail.example.com','192.0.2.12','A',120,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'localhost.example.com','127.0.0.1','A',120,NULL);
+INSERT INTO records (domain_id, name, content, type,ttl,prio)
+VALUES (1,'example.com','mail.example.com','MX',120,25);
+```
+
+**Warning**: Host names and the MNAME of a SOA records are NEVER terminated with a '.' in PowerDNS storage! If a trailing '.' is present it will inevitably cause problems, problems that may be hard to debug.
+
+If we now requery our database, **www.example.com** should be present:
+
+```
+$ host www.example.com 127.0.0.1
+www.example.com A 192.0.2.10
+
+$ host -v -t mx example.com 127.0.0.1
+Address: 127.0.0.1
+Aliases: localhost
+
+Query about example.com for record types MX
+Trying example.com ...
+Query done, 1 answer, authoritative status: no error
+example.com 120 IN MX 25 mail.example.com
+Additional information:
+mail.example.com 120 IN A 192.0.2.12
+```
+
+To confirm what happened, issue the command `SHOW *` to the control console:
+
+```
+ % show *
+ corrupt-packets=0,latency=0,packetcache-hit=2,packetcache-miss=5,packetcache-size=0,
+ qsize-a=0,qsize-q=0,servfail-packets=0,tcp-answers=0,tcp-queries=0,
+ timedout-packets=0,udp-answers=7,udp-queries=7,
+ %
+```
+
+The actual numbers will vary somewhat. Now enter `QUIT` and start PDNS as a regular daemon, and check launch status:
+
+```
+ # /etc/init.d/pdns start
+ pdns: started
+ # /etc/init.d/pdns status
+ pdns: 8239: Child running
+ # /etc/init.d/pdns dump
+ pdns: corrupt-packets=0,latency=0,packetcache-hit=0,packetcache-miss=0,
+ packetcache-size=0,qsize-a=0,qsize-q=0,servfail-packets=0,tcp-answers=0,
+ tcp-queries=0,timedout-packets=0,udp-answers=0,udp-queries=0,
+```
+
+You now have a working database driven nameserver! To convert other zones already present, use the **zone2sql** described in Appendix A.
+
+## Common problems
+Most problems involve PDNS not being able to connect to the database.
+
+### Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
+Your MySQL installation is probably defaulting to another location for its socket. Can be resolved by figuring out this location (often `/var/run/mysqld.sock`), and specifying it in the configuration file with the **gmysql-socket** parameter.
+
+Another solution is to not connect to the socket, but to 127.0.0.1, which can be achieved by specifying **gmysql-host=127.0.0.1**.
+
+### Host 'x.y.z.w' is not allowed to connect to this MySQL server
+These errors are generic MySQL errors. Solve them by trying to connect to your MySQL database with the MySQL console utility **mysql** with the parameters specified to PDNS. Consult the MySQL documentation.
# Running PowerDNS
PDNS is normally controlled via a SysV-style init.d script, often located in `/etc/init.d` or `/etc/rc.d/init.d`. This script accepts the following commands:
### Unable to launch, no backends configured for querying
PDNS did not find the `launch=bind` instruction in pdns.conf.
-# Multiple IP addresses on your server, PDNS sending out answers on the wrong one, Massive amounts of 'recvfrom gave error, ignoring: Connection refused'
+### Multiple IP addresses on your server, PDNS sending out answers on the wrong one, Massive amounts of 'recvfrom gave error, ignoring: Connection refused'
If you have multiple IP addresses on the internet on one machine, UNIX often sends out answers over another interface than which the packet came in on. In such cases, use `local-address` to bind to specific IP addresses, which can be comma separated. The second error comes from remotes disregarding answers to questions it didn't ask to that IP address and sending back ICMP errors.
### gmysql backend with nodnssec schema
-```
-/* Uncomment next line for versions <= 3.1 */
-/* DROP INDEX rec_name_index ON records; */
-
-ALTER TABLE records ADD disabled TINYINT(1) DEFAULT 0;
-ALTER TABLE records MODIFY content VARCHAR(64000) DEFAULT NULL;
-ALTER TABLE records ADD ordername VARCHAR(255) BINARY DEFAULT NULL;
-ALTER TABLE records ADD auth TINYINT(1) DEFAULT 1;
-ALTER TABLE records MODIFY type VARCHAR(10);
-ALTER TABLE supermasters MODIFY ip VARCHAR(64) NOT NULL;
-ALTER TABLE supermasters ADD PRIMARY KEY(ip, nameserver);
-
-CREATE INDEX recordorder ON records (domain_id, ordername);
-
-
-CREATE TABLE domainmetadata (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- kind VARCHAR(32),
- content TEXT,
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
-
-
-CREATE TABLE cryptokeys (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- flags INT NOT NULL,
- active TINYINT(1),
- content TEXT,
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id INT AUTO_INCREMENT,
- name VARCHAR(255),
- algorithm VARCHAR(50),
- secret VARCHAR(255),
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
-
-
-CREATE TABLE comments (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) NOT NULL,
- comment VARCHAR(64000) NOT NULL,
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
+```{include=../../modules/gmysqlbackend/nodnssec-3.x_to_3.4.0_schema.mysql.sql}
```
### gmysql backend with dnssec schema
-```
-/* Uncomment next 3 lines for versions <= 3.1 */
-/* DROP INDEX rec_name_index ON records; */
-/* DROP INDEX orderindex ON records; */
-/* CREATE INDEX recordorder ON records (domain_id, ordername); */
-
-ALTER TABLE records ADD disabled TINYINT(1) DEFAULT 0 AFTER change_date;
-ALTER TABLE records MODIFY content VARCHAR(64000) DEFAULT NULL;
-ALTER TABLE records MODIFY ordername VARCHAR(255) BINARY DEFAULT NULL;
-ALTER TABLE records MODIFY auth TINYINT(1) DEFAULT 1;
-ALTER TABLE records MODIFY type VARCHAR(10);
-ALTER TABLE supermasters MODIFY ip VARCHAR(64) NOT NULL;
-ALTER TABLE supermasters ADD PRIMARY KEY(ip, nameserver);
-ALTER TABLE domainmetadata MODIFY kind VARCHAR(32);
-ALTER TABLE tsigkeys MODIFY algorithm VARCHAR(50);
-
-DROP INDEX domainmetaidindex ON domainmetadata;
-CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
-
-CREATE TABLE comments (
- id INT AUTO_INCREMENT,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) NOT NULL,
- comment VARCHAR(64000) NOT NULL,
- PRIMARY KEY(id)
-) Engine=InnoDB;
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
+```{include=../../modules/gmysqlbackend/dnssec-3.x_to_3.4.0_schema.mysql.sql}
```
### gpgsql backend with nodnssec schema
-```
-/* Uncomment next line for versions <= 3.3 */
-/* ALTER TABLE domains ADD CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT))); */
-
-ALTER TABLE records ADD disabled BOOL DEFAULT 'f';
-ALTER TABLE records ALTER COLUMN content TYPE VARCHAR(65535);
-ALTER TABLE records ADD ordername VARCHAR(255);
-ALTER TABLE records ADD auth BOOL DEFAULT 't';
-ALTER TABLE records ALTER COLUMN type TYPE VARCHAR(10);
-ALTER TABLE supermasters ALTER COLUMN ip TYPE INET USING ip::INET;
-ALTER TABLE supermasters ADD CONSTRAINT supermasters_pkey PRIMARY KEY (ip, nameserver);
-
-CREATE INDEX recordorder ON records (domain_id, ordername text_pattern_ops);
-
-
-CREATE TABLE domainmetadata (
- id SERIAL PRIMARY KEY,
- domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
- kind VARCHAR(32),
- content TEXT
-);
-
-CREATE INDEX domainidmetaindex ON domainmetadata(domain_id);
-
-
-CREATE TABLE cryptokeys (
- id SERIAL PRIMARY KEY,
- domain_id INT REFERENCES domains(id) ON DELETE CASCADE,
- flags INT NOT NULL,
- active BOOL,
- content TEXT
-);
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id SERIAL PRIMARY KEY,
- name VARCHAR(255),
- algorithm VARCHAR(50),
- secret VARCHAR(255),
- constraint c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
-
-
-CREATE TABLE comments (
- id SERIAL PRIMARY KEY,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL,
- CONSTRAINT domain_exists
- FOREIGN KEY(domain_id) REFERENCES domains(id)
- ON DELETE CASCADE,
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
+```{include=../../modules/gpgsqlbackend/nodnssec-3.x_to_3.4.0_schema.pgsql.sql}
```
### gpgsql backend with dnssec schema:
-``` {.programlisting}
-/* Uncomment next 2 lines for versions <= 3.3 */
-/* ALTER TABLE domains ADD CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT))); */
-/* ALTER TABLE tsigkeys ADD CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT))); */
-
-ALTER TABLE records ADD disabled BOOL DEFAULT 'f';
-ALTER TABLE records ALTER COLUMN content TYPE VARCHAR(65535);
-ALTER TABLE records ALTER COLUMN auth SET DEFAULT 't';
-ALTER TABLE records ALTER COLUMN type TYPE VARCHAR(10);
-ALTER TABLE supermasters ALTER COLUMN ip TYPE INET USING ip::INET;
-ALTER TABLE supermasters ADD CONSTRAINT supermasters_pkey PRIMARY KEY (ip, nameserver);
-ALTER TABLE domainmetadata ALTER COLUMN kind TYPE VARCHAR(32);
-ALTER TABLE tsigkeys ALTER COLUMN algorithm TYPE VARCHAR(50);
-
-CREATE INDEX recordorder ON records (domain_id, ordername text_pattern_ops);
-DROP INDEX IF EXISTS orderindex;
-
-
-CREATE TABLE comments (
- id SERIAL PRIMARY KEY,
- domain_id INT NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL,
- CONSTRAINT domain_exists
- FOREIGN KEY(domain_id) REFERENCES domains(id)
- ON DELETE CASCADE,
- CONSTRAINT c_lowercase_name CHECK (((name)::TEXT = LOWER((name)::TEXT)))
-);
-
-CREATE INDEX comments_domain_id_idx ON comments (domain_id);
-CREATE INDEX comments_name_type_idx ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
+```{include=../../modules/gpgsqlbackend/dnssec-3.x_to_3.4.0_schema.pgsql.sql}
```
### gsqlite3 backend with nodnssec schema
-```
-ALTER TABLE records ADD disabled BOOL DEFAULT 0;
-ALTER TABLE records ADD ordername VARCHAR(255);
-ALTER TABLE records ADD auth BOOL DEFAULT 1;
-
-CREATE INDEX orderindex ON records(ordername);
-
-
-CREATE TABLE domainmetadata (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- kind VARCHAR(32) COLLATE NOCASE,
- content TEXT
-);
-
-CREATE INDEX domainmetaidindex on domainmetadata(domain_id);
-
-
-CREATE TABLE cryptokeys (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- flags INT NOT NULL,
- active BOOL,
- content TEXT
-);
-
-CREATE INDEX domainidindex ON cryptokeys(domain_id);
-
-
-CREATE TABLE tsigkeys (
- id INTEGER PRIMARY KEY,
- name VARCHAR(255) COLLATE NOCASE,
- algorithm VARCHAR(50) COLLATE NOCASE,
- secret VARCHAR(255)
-);
-
-CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
-
-
-CREATE TABLE comments (
- id INTEGER PRIMARY KEY,
- domain_id INTEGER NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL
-);
-
-CREATE INDEX comments_domain_id_index ON comments (domain_id);
-CREATE INDEX comments_nametype_index ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
-
-
-BEGIN TRANSACTION;
- CREATE TEMPORARY TABLE supermasters_backup (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL COLLATE NOCASE,
- account VARCHAR(40) DEFAULT NULL
- );
-
- INSERT INTO supermasters_backup SELECT ip, nameserver, account FROM supermasters;
- DROP TABLE supermasters;
-
- CREATE TABLE supermasters (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL COLLATE NOCASE,
- account VARCHAR(40) DEFAULT NULL
- );
- CREATE UNIQUE INDEX ip_nameserver_pk ON supermasters(ip, nameserver);
-
- INSERT INTO supermasters SELECT ip, nameserver, account FROM supermasters_backup;
- DROP TABLE supermasters_backup;
-COMMIT;
+```{include=../../modules/gsqlite3backend/nodnssec-3.x_to_3.4.0_schema.sqlite3.sql}
```
### gsqlite3 backend with dnssec schema:
-```
-CREATE TABLE comments (
- id INTEGER PRIMARY KEY,
- domain_id INTEGER NOT NULL,
- name VARCHAR(255) NOT NULL,
- type VARCHAR(10) NOT NULL,
- modified_at INT NOT NULL,
- account VARCHAR(40) DEFAULT NULL,
- comment VARCHAR(65535) NOT NULL
-);
-
-CREATE INDEX comments_domain_id_index ON comments (domain_id);
-CREATE INDEX comments_nametype_index ON comments (name, type);
-CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
-
-
-BEGIN TRANSACTION;
- CREATE TEMPORARY TABLE records_backup(
- id INTEGER PRIMARY KEY,
- domain_id INTEGER DEFAULT NULL,
- name VARCHAR(255) DEFAULT NULL,
- type VARCHAR(10) DEFAULT NULL,
- content VARCHAR(65535) DEFAULT NULL,
- ttl INTEGER DEFAULT NULL,
- prio INTEGER DEFAULT NULL,
- change_date INTEGER DEFAULT NULL,
- ordername VARCHAR(255),
- auth BOOL DEFAULT 1
- );
-
- INSERT INTO records_backup SELECT id,domain_id,name,type,content,ttl,prio,change_date,ordername,auth FROM records;
- DROP TABLE records;
-
- CREATE TABLE records (
- id INTEGER PRIMARY KEY,
- domain_id INTEGER DEFAULT NULL,
- name VARCHAR(255) DEFAULT NULL,
- type VARCHAR(10) DEFAULT NULL,
- content VARCHAR(65535) DEFAULT NULL,
- ttl INTEGER DEFAULT NULL,
- prio INTEGER DEFAULT NULL,
- change_date INTEGER DEFAULT NULL,
- disabled BOOLEAN DEFAULT 0,
- ordername VARCHAR(255),
- auth BOOL DEFAULT 1
- );
-
- 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 INDEX orderindex ON records(ordername);
-
- INSERT INTO records SELECT id,domain_id,name,type,content,ttl,prio,change_date,0,ordername,auth FROM records_backup;
- DROP TABLE records_backup;
-COMMIT;
-
-
-BEGIN TRANSACTION;
- CREATE TEMPORARY TABLE supermasters_backup (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL COLLATE NOCASE,
- account VARCHAR(40) DEFAULT NULL
- );
-
- INSERT INTO supermasters_backup SELECT ip,nameserver,account FROM supermasters;
- DROP TABLE supermasters;
-
- CREATE TABLE supermasters (
- ip VARCHAR(64) NOT NULL,
- nameserver VARCHAR(255) NOT NULL COLLATE NOCASE,
- account VARCHAR(40) DEFAULT NULL
- );
- CREATE UNIQUE INDEX ip_nameserver_pk ON supermasters(ip, nameserver);
-
- INSERT INTO supermasters SELECT ip,nameserver,account FROM supermasters_backup;
- DROP TABLE supermasters_backup;
-COMMIT;
-
-
-BEGIN TRANSACTION;
- CREATE TABLE domainmetadata__backup (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- kind VARCHAR(32) COLLATE NOCASE,
- content TEXT
- );
-
- INSERT INTO domainmetadata_backup SELECT id,domain_id,kind,content FROM domainmetadata;
- DROP TABLE domainmetadata;
-
- CREATE TABLE domainmetadata (
- id INTEGER PRIMARY KEY,
- domain_id INT NOT NULL,
- kind VARCHAR(32) COLLATE NOCASE,
- content TEXT
- );
- CREATE INDEX domainmetaidindex ON domainmetadata(domain_id);
-
- INSERT INTO domainmetadata SELECT id,domain_id,kind,content FROM domainmetadata_backup;
- DROP TABLE domainmetadata_backup;
-COMMIT;
+```{include=../../modules/gsqlite3backend/dnssec-3.x_to_3.4.0_schema.sqlite3.sql}
```
### goracle backend:
ALTER TABLE records MODIFY auth INT DEFAULT 1;
UPDATE records SET auth=1 WHERE auth IS NULL;
+
+ALTER TABLE domainmetadata MODIFY kind VARCHAR2(32);
```
## Configuration option changes
When you launch PDNS via this renamed script, it will seek configuration instructions not in `pdns.conf` but in `pdns-name.conf`, allowing for separate specification of parameters.
-**Warninge**: Be aware however that the init.d `force-stop` will kill all PDNS instances!
+**Warning**: Be aware however that the init.d `force-stop` will kill all PDNS instances!
--- /dev/null
+#!/usr/bin/env python
+
+"""
+Pandoc filter to process code blocks with class "include" and
+replace their content with the included file
+"""
+
+from pandocfilters import toJSONFilter, CodeBlock
+
+
+def code_include(key, value, format, meta):
+ if key == 'CodeBlock':
+ [[ident, classes, namevals], code] = value
+ for nameval in namevals:
+ if nameval[0] == 'include':
+ with open(nameval[1], 'rb') as content_file:
+ content = content_file.read()
+ content.decode('utf-8')
+ namevals.remove(nameval)
+ return CodeBlock([ident, classes, namevals], content)
+
+if __name__ == "__main__":
+ toJSONFilter(code_include)
site_name: PowerDNS
repo_url: https://github.com/PowerDNS/pdns
-docs_dir: markdown
+docs_dir: doc-build
site_dir: html-new
theme_dir: markdown/theme
pages:
--- /dev/null
+#!/bin/sh
+
+for file in `find doc-build -name '*.md' -type f -print`; do
+ pandoc -f markdown_github -t markdown_github -F markdown/process-includes.py $file -o $file
+done