我一直致力于让 PowerDNS 在最新的 CentOS 7 x64 上运行。
除 Nginx 之外的所有内容均遵循本指南,因为我使用的是 Apache:https://www.rosehosting.com/blog/install-powerdns-and-on-a-centos-7-vps/
防火墙已禁用。 SELinux 设置为仅监视。
下面是我的数据库,请注意 PowerDNS 的 Web 管理工作得很好。
dig
但是我在任何尝试中都会遇到 servfail 。请参阅下面的数据库输出和 pdns conf。
请帮我找出问题所在!
请注意,我使用的是 BIND,它工作得很好,但我想要一个数据库驱动的 DNS 系统,所以我正在尝试让 PDNS 工作。正如您从 netstat 输出中看到的那样,BIND 在这些测试期间停止。
版本:
# pdns_control version
3.4.7
数据库信息:
MariaDB [powerdns]> show tables;
+--------------------+
| Tables_in_powerdns |
+--------------------+
| domains |
| migrations |
| perm_items |
| perm_templ |
| perm_templ_items |
| records |
| records_zone_templ |
| supermasters |
| users |
| zone_templ |
| zone_templ_records |
| zones |
+--------------------+
MariaDB [powerdns]> select * from domains;
+----+----------------------+--------+------------+--------+-----------------+---------+
| id | name | master | last_check | type | notified_serial | account |
+----+----------------------+--------+------------+--------+-----------------+---------+
| 2 | example.com | NULL | NULL | MASTER | NULL | NULL |
+----+----------------------+--------+------------+--------+-----------------+---------+
MariaDB [powerdns]> select * from records;
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+
| id | domain_id | name | type | content | ttl | prio | change_date |
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+
| 5 | 2 | example.com | SOA | ns1.example.com [email protected] 2016012205 28800 7200 604800 86400 | 86400 | 0 | 1453430301 |
| 6 | 2 | example.com | A | | 86400 | 0 | 1453430985 |
| 7 | 2 | mail.example.com | A | 123.123.123.123 | 86400 | 0 | 1453430985 |
| 8 | 2 | ns1.example.com | A | 123.123.123.123 | 86400 | 0 | 1453430985 |
+----+-----------+------------------+------+--------------------------------------------------------------------------+-------+------+-------------+
用于挖掘任何记录的 DIG 输出:
# dig @127.0.0.1
; <<>> DiG 9.9.4-RedHat-9.9.4-29.el7_2.1 <<>> @127.0.0.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 3023
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1680
;; QUESTION SECTION:
;. IN NS
;; Query time: 1 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Jan 22 18:10:21 EST 2016
;; MSG SIZE rcvd: 28
PDNS 配置:
# nano /etc/pdns/pdns.conf:
setuid=pdns
setgid=pdns
launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=lolololol
gmysql-dbname=powerdns
NETSTAT 输出:
# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:cslistener 0.0.0.0:* LISTEN 950/php-fpm: master
tcp 0 0 0.0.0.0:mysql 0.0.0.0:* LISTEN 1783/mysqld
tcp 0 0 0.0.0.0:ndmp 0.0.0.0:* LISTEN 2561/perl
tcp 0 0 0.0.0.0:domain 0.0.0.0:* LISTEN 12283/pdns_server
tcp 0 0 0.0.0.0:8822 0.0.0.0:* LISTEN 1233/sshd
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN 1826/master
tcp6 0 0 [::]:http [::]:* LISTEN 900/httpd
tcp6 0 0 [::]:8821 [::]:* LISTEN 15532/vsftpd
tcp6 0 0 [::]:8822 [::]:* LISTEN 1233/sshd
tcp6 0 0 localhost:smtp [::]:* LISTEN 1826/master
# netstat -uap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:ndmp 0.0.0.0:* 2561/perl
udp 0 0 0.0.0.0:domain 0.0.0.0:* 12283/pdns_server
udp 0 0 0.0.0.0:bootpc 0.0.0.0:* 1028/dhclient
udp 0 0 localhost:323 0.0.0.0:* 621/chronyd
udp 0 0 0.0.0.0:13651 0.0.0.0:* 1028/dhclient
udp6 0 0 localhost:323 [::]:* 621/chronyd
udp6 0 0 [::]:50691 [::]:* 1028/dhclient
答案1
我设置了一个 syslog 服务器来查看日志,并发现了以下内容: Jan 23 18:15:09 s01 pdns[27536]: Backend error: GSQLBackend Lookup query:Failed to execute mysql_query, Maybe connection dead? Err=1:“字段列表”中的未知列“已禁用”
这导致建议使用的数据库模式可能不正确。我删除了所有表并从下面这两页导入了部分 MySQL 模式,然后重新启动了 pdns 服务,它就可以工作了! https://github.com/poweradmin/poweradmin/blob/master/sql/poweradmin-mysql-db-struct.sql https://doc.powerdns.com/md/authoritative/installation/