mysql driver could not create database instance object(bind dlz)

bind dlz(mysql)运行过程时出现如下错误:

Nov 24 10:35:01 lbbackup named[4155]: starting BIND 9.7.1-P2 -u named -c /usr/local/bind/etc/named.conf.mysql
Nov 24 10:35:01 lbbackup named[4155]: built with ‘–prefix=/usr/local/bind’ ‘–with-dlz-mysql=/usr/local/mysql’ ‘–enable-threads=no
‘ ‘–enable-largefile’
Nov 24 10:35:01 lbbackup named[4155]: using up to 4096 sockets
Nov 24 10:35:01 lbbackup named[4155]: loading configuration from ‘/usr/local/bind/etc/named.conf.mysql’
Nov 24 10:35:01 lbbackup named[4155]: reading built-in trusted keys from file ‘/usr/local/bind/etc/bind.keys’
Nov 24 10:35:01 lbbackup named[4155]: using default UDP/IPv4 port range: [1024, 65535]
Nov 24 10:35:01 lbbackup named[4155]: using default UDP/IPv6 port range: [1024, 65535]
Nov 24 10:35:01 lbbackup named[4155]: listening on IPv4 interface lo, 127.0.0.1#53
Nov 24 10:35:01 lbbackup named[4155]: listening on IPv4 interface eth0, 192.168.146.155#53
Nov 24 10:35:01 lbbackup named[4155]: listening on IPv4 interface eth1, 10.0.0.155#53
Nov 24 10:35:01 lbbackup named[4155]: Required root permissions to open ‘/usr/local/bind/var/run/named.pid’.
Nov 24 10:35:01 lbbackup named[4155]: Please check file and directory permissions or reconfigure the filename.
Nov 24 10:35:01 lbbackup named[4155]: generating session key for dynamic DNS
Nov 24 10:35:01 lbbackup named[4155]: Loading ‘Mysql zone’ using driver mysql
Nov 24 10:35:01 lbbackup named[4155]: Required token $zone$ not found.
Nov 24 10:35:01 lbbackup named[4155]: Could not build all nodes query list
Nov 24 10:35:01 lbbackup named[4155]: mysql driver could not create database instanceobject.
段错误 (core dumped) #加-g -d 1时出现

配置文件如下:

dlz "Mysql zone" {
database "mysql
{host=localhost dbname=mydns_data ssl=false port=3306 user=root pass=sok12345}
{select zone from dns_records where zone = '%zone%'}
{select ttl, type, mx_priority, case when lower(type)='txt' then concat('\"', data, '\"')
else data end from dns_records where zone = '%zone%' and host = '%record%'
and not (type = 'SOA' or type = 'NS')}
{select ttl, type, mx_priority, data, resp_person, serial, refresh, retry, expire, minimum
from dns_records where zone = '%zone%' and (type = 'SOA' or type='NS')}
{select ttl, type, host, mx_priority, data, resp_person, serial, refresh, retry, expire,
minimum from dns_records where zone = '%zone%' and not (type = 'SOA' or type = 'NS')}";
# {select zone from xfr_table where zone = '%zone%' and client = '%client%'}
# {update data_count set count = count + 1 where zone ='%zone%'}";
};

解决办法:

将配置节dlz “Mysql zone”中的%号更改为$符号即可。

Some versions of DLZ used ‘%’ to demarcate tokens, but they can cause problems for the LDAP driver.  Subsequent patches have changed the token demarcation to ‘$’.  It looks like your updated version (that’s failing) is using the ‘$’ symbols.  If your config file is a few years old and still using the ‘%’, it will suddenly fail at startup.
Simple solution is to check what your file is using around the tokens, and if it’s ‘%’, change them to ‘$’ after the upgrade.”

发表评论