Several basic questions (and yes, I've looked at the documentation on the web)

Scott Haneda talklists at newgeo.com
Tue May 12 01:35:02 UTC 2009


You may also want to take this to the DLZ users mailing list, I am  
really not sure the correct channel for these questions.  I end up  
cross posting, which is probably not a good idea.

On May 11, 2009, at 3:25 PM, Mike Toler wrote:

> What there is of it.  It seems VERY outdated since, if I understand  
> correctly, DLZ is now built into bind 9.5/9.6.

I have been pretty deep in the DLZ and SDB thing lately as well,  
getting ready to get the secondary working now.

I too would like to hear clarification on the difference of DLZ and  
SDB.  From what I can gather, DLZ was built into BIND a while back, or  
support was.

I also, on RHEL, have this SDB thing.  On OS X, as a test case, I do  
not recall having that, and just added a compile flag through a port  
manager to BIND.

The dates on the project are very old.  The docs seem accurate,  
current, and fine, but a several year old date on anything leads me to  
a tiny bit of confusion.

> I have downloaded and installed the following RPMs to my DNS server,  
> which is a VM running RHEL 5.2:
> bind-9.5.1-2.P2.el5.pp.x86_64.rpm
> bind-libs-9.5.1-2.P2.el5.pp.x86_64.rpm
> bind-sdb-9.5.1-2.P2.el5.pp.x86_64.rpm
> bind-utils-9.5.1-2.P2.el5.pp.x86_64.rpm

Sounds like you are in the same boat as me, other than I am not in a  
VM.  Looking over my notes, Here is what I did, maybe you just need to  
install the sdb or activate it?

Here is a very condensed form of the notes I took.

      yum install libtool
      yum install libcap-devel
      yum install openldap-devel
      yum install postgresql-devel
      yum install rpmbuild

      rpmbuild -bb /usr/src/redhat/SPECS/bind.spec
      * Conidered editing .spec file to remove postgres, ldap and  
others, decided
      they are good to have, and will be needed by other installs.

      rpm -ivh /usr/src/redhat/RPMS/x86_64/bind- 
libs-9.6.0-2.P1.x86_64.rpm
      rpm -ivh /usr/src/redhat/RPMS/x86_64/bind-9.6.0-2.P1.x86_64.rpm
      rpm -ivh /usr/src/redhat/RPMS/x86_64/bind- 
utils-9.6.0-2.P1.x86_64.rpm
      rpm -ivh /usr/src/redhat/RPMS/x86_64/bind- 
devel-9.6.0-2.P1.x86_64.rpm

      At this point, named will start, with some fiddling, but DLZ  
support
      is not working

      Install the sdb
      rpm -ivh /usr/src/redhat/RPMS/x86_64/bind- 
sdb-9.6.0-2.P1.x86_64.rpm

      edited /etc/sysconfig/named
      copied /usr/share/doc/bind-9.3.4/sample/etc/* to /etc/
      copied /usr/share/doc/bind-9.3.4/sample/var/* to /var/
      edited /etc/named.conf

      At this point, I ran into SELinux issues, and fought with them.
      /etc/selinux/config set to disabled.
      To avoid restaring the server: echo 0 > /selinux/enforce

      /var/named needs to be named:named
      start and stop with sudo /etc/init.d/named start|stop|restart

      start by hand:
      /usr/sbin/named -f -d 1
      -f is foreground, and -d is debug level 1, up if desired

>  I have added the exact DLZ configuration from the DLZ web page,  
> other than the IP address and userid for the DB.

I went MySql

>  dlz "postgres zone" {
>    database "postgres 1
>    {host=int-dbs port=5432 dbname=dns_data user=postgres}
>    {select zone from dns_records where zone = '%zone%'}
>    {select ttl, type, mx_priority, case when lower(type)='txt' then  
> '\"'
>          || data || '\"' when lower(type)='soa' then data || ' ' ||  
> resp_person || ' '
>          || serial || ' ' || refresh || ' ' || retry || ' ' ||  
> expire || ' ' || minimum
>          else data end from dns_records where zone = '%zone%' and  
> host = '%record%'}
>    {}
>    {select ttl, type, host, mx_priority, case when lower(type)='txt'  
> then '\"'
>          || data || '\"' else data end, resp_person, serial,  
> refresh, retry, expire,
>         minimum from dns_records where zone = '%zone%'}
>    {select zone from xfr_table where zone = '%zone%' and client =  
> '%client%'}";
> };
>
> I have created a duplicate of one zone in my Postgres database using  
> the tables described (Though I used “character varying” instead of  
> “text”)
>
> When I start “named” (or “named_sdb”, whatever that is??),

You definitely want to make sure you are starting named_sdb, using ps  
look for it to confirm.

> I see no reference to any attempts to get to the postgres DB.  No  
> failures, no successes, nothing.  In another e-mail on the list, I  
> saw logs that showed the loading of the postgres drivers.  I don’t  
> see that in my log files at all?

What logs are you looking at, on RHEL I see in /var/log/messages I  
will get a line of the build flags followed by mentions of each of the  
extensions for each database I am able to support.

>  So . . .
> 1.       Is there something other than the DLZ tag that needs to go  
> into the named.conf to tell it to use a postgres DB?

No.  I have a very normal /etc/named.conf
I got named running before I even tried to get DLZ/SDB working.  I  
made sure I could return queries to some local text file based zones.

At the bottom of the named.conf file, I added in:
include "dlz_mysql.conf";

In that file, I have the same copy and paste you took from the site  
but mine is for MySql.

> 2.      Is there some library I have not deployed that is required?

If you got a successful install, I do not think there is.

> 3.      Should I be running “named” or “named_sdb”?

named_sdb

> 4.      (and my real question) can you have both “zone” and “dlz”  
> tags in the same named.conf?  Our project has a large, static set of  
> DNS domains and a very small set of dynamic domains.   I’d like to  
> be able to take advantage of the speed of the flat files, and only  
> hit postgres for for the dynamic sub-domains and still have only one  
> DNS server.   If it can’t do this, that will just mean I need both  
> static and dynamic servers.

I am doing just this.  There actually is a thread in the DLZ mailing  
list archive where I asked the exact same question.  There are some  
zones that will just not change, and they are hit heavily.  I was not  
wanting to have the DB hit that hard all the time when named can  
handle them more efficiently outside of the database.

You could install named-sdb and never use the database at all, just  
use flat files, it will be fine.

> dlz "postgres zone" {
>    database "postgres 1
>    {host=int-dbs port=5432 dbname=dns_data user=postgres}
>    {select zone from dns_records where zone = '%zone%'}
>    {select ttl, type, mx_priority, case when lower(type)='txt' then  
> '\"'
>          || data || '\"' when lower(type)='soa' then data || ' ' ||  
> resp_person || ' '
>          || serial || ' ' || refresh || ' ' || retry || ' ' ||  
> expire || ' ' || minimum
>          else data end from dns_records where zone = '%zone%' and  
> host = '%record%'}
>    {}
>    {select ttl, type, host, mx_priority, case when lower(type)='txt'  
> then '\"'
>          || data || '\"' else data end, resp_person, serial,  
> refresh, retry, expire,
>         minimum from dns_records where zone = '%zone%'}
>    {select zone from xfr_table where zone = '%zone%' and client =  
> '%client%'}";
> };


It looks ok to me, though I do not use postgres.  I couple hints. Open  
up a few terminal windows, tail your named logs, I have mine separated  
into three, but whatever you have, get them to a point you can look at  
them.

Look into the issues with threaded mode, I am not sure it applies to  
postgres, this issue caused me some pain.

tail -f your /var/log/messages log as well.

Restart your named, and see what you are getting.

Start it from the command line where you have control of it.  Give it  
options such as
-g -d 1 which sends it into debug mode and the -g puts messages to  
stdout.

Finally, for me, I turned on mysql query logging, turn on the  
equivalent to postgres.  This will be pretty noisy if there is other  
stuff going on, but you need to see what is coming in here as well.

 From what I remember, if when you start it on the command line with - 
g and you do not see something a lot like this, then you have install  
issues:

May  9 02:18:07 host named-sdb[29533]: adjusted limit on open files  
from 1024 to 1048576
May  9 02:18:07 host named-sdb[29533]: found 8 CPUs, using 1 worker  
thread
May  9 02:18:07 host named-sdb[29533]: using up to 4096 sockets
May  9 02:18:07 host named-sdb[29533]: SDB ldap zone database module  
loaded.
May  9 02:18:07 host named-sdb[29533]: SDB postgreSQL DB zone database  
module loaded.
May  9 02:18:07 host named-sdb[29533]: SDB sqlite3 DB zone database  
module loaded.
May  9 02:18:07 host named-sdb[29533]: SDB directory DB zone database  
module loaded.
May  9 02:18:07 host named-sdb[29533]: loading configuration from '/ 
etc/named.conf'
May  9 02:18:07 host named-sdb[29533]: using default UDP/IPv4 port  
range: [1024, 65535]
May  9 02:18:07 host named-sdb[29533]: using default UDP/IPv6 port  
range: [1024, 65535]
May  9 02:18:07 host named-sdb[29533]: listening on IPv4 interface lo,  
127.0.0.1#53
May  9 02:18:07 host named-sdb[29533]: listening on IPv4 interface  
eth0, xxx.122.xxx.18#53
May  9 02:18:07 host named-sdb[29533]: listening on IPv4 interface  
eth0:0, xxx.122.xxx.19#53
May  9 02:18:07 host named-sdb[29533]: listening on IPv4 interface  
eth0:1, xxx.122.xxx.20#53
May  9 02:18:07 host named-sdb[29533]: listening on IPv4 interface  
virbr0, 192.168.122.1#53
May  9 02:18:07 host named-sdb[29533]: binding TCP socket: address in  
use
May  9 02:18:07 host named-sdb[29533]: Loading 'Mysql zone' using  
driver mysql
May  9 02:18:07 host named-sdb[29533]: command channel listening on  
127.0.0.1#953

Hope that helps, fire away with any other questions you have.  RHEL is  
pretty new to me, but I will do my best.
-- 
Scott * If you contact me off list replace talklists@ with scott@ *




More information about the bind-users mailing list