Francesco Collini | 6 Mar 2012 16:37
Picon

PgBouncer and Bind DLZ

Hello Bind-DLZ ML!

Since i use a growing numbers of view, each one with a bind-dlz
statement, i have persistent connections to the postgresql database.

As i read it is not possible to reuse connections, i tried to
integrate pgBouncer in bind-dlz, as a frontend driver to postgresql
connection.

It seems reusing connections, and when i connection is not
transmitting, it reuse it.

As someone tried this or some other postgresql proxy?

Thank you!
Francesco

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
data tanger | 21 Mar 2012 19:39
Picon
Favicon

dlz ignores connection to postgres database

Hi everyone,

I tried to use the Bind Dlz driver but I can't get it to connect to the 
database.When I start Bind, I don't see any error but I think it 
ignores the connection to 
the database. 
I tried both Postgresql and Mysql with no success.
Here's what I added to the named.conf file:

dlz "PostgresZone" { 
database "postgres
{host=localhost port=5432 dbname=dnsdb user=dnsuser}
{SELECT id FROM zones WHERE zone = lower('%zone%') LIMIT 1}
{SELECT ttl, ttype, mx_priority, ddata FROM zones z, rrset r WHERE z.id=r.zid
AND zone = lower('%zone%') AND host = lower('%record%') AND type NOT 
IN('SOA','NS')}
{SELECT ttl, ttype, mx_priority, ddata, resp_person, serial, refresh, 
retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid AND zone = 
lower('%zone%') AND type IN('SOA','NS')}
{SELECT ttl, ttype, host, mx_priority, ddata, resp_person, serial, 
refresh, retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid
AND zone = lower('%zone%'}
{SELECT id FROM axfr WHERE zone = lower('%zone%' AND ip = '%client%'}";
};

Any help please?

Thank you in advance
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bind-dlz-testers mailing list
Bind-dlz-testers <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
Todd Lyons | 21 Mar 2012 21:28
Gravatar

Re: dlz ignores connection to postgres database

2012/3/21 data tanger <datatanger <at> hotmail.fr>:
> Hi everyone,
>
> I tried to use the Bind Dlz driver but I can't get it to connect to the
> database.When I start Bind, I don't see any error but I think it
> ignores the connection to
> the database.
> I tried both Postgresql and Mysql with no success.

First debugging step, enable query logging, or use tcpdump and dump
the raw packets to see the query and the response.

> Here's what I added to the named.conf file:
>
> dlz "PostgresZone" {
> database "postgres
> {host=localhost port=5432 dbname=dnsdb user=dnsuser}
> {SELECT id FROM zones WHERE zone = lower('%zone%') LIMIT 1}

You're returning the id from the query, when all of the examples (and
my working config on mysql) return the zone field.  Change that, see
if it works.

> {SELECT ttl, ttype, mx_priority, ddata FROM zones z, rrset r WHERE
> z.id=r.zid
> AND zone = lower('%zone%') AND host = lower('%record%') AND type NOT
> IN('SOA','NS')}
> {SELECT ttl, ttype, mx_priority, ddata, resp_person, serial, refresh,
> retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid AND zone =
> lower('%zone%') AND type IN('SOA','NS')}
> {SELECT ttl, ttype, host, mx_priority, ddata, resp_person, serial,
> refresh, retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid	
> AND zone = lower('%zone%'}
> {SELECT id FROM axfr WHERE zone = lower('%zone%' AND ip = '%client%'}";

And in your xfer query, you're again returning the id instead of the zone field.

> };
>
> Any help please?

Try those and see what happens.

...Todd

--

-- 
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
data tanger | 22 Mar 2012 12:18
Picon
Favicon

Re: dlz ignores connection to postgres database

Thank you for your answer. I took the queries I put in my config file from this book  http://jpmens.net/2010/10/29/alternative-dns-servers-the-book-as-pdf/ 
which I think is well explained.
My problem is not with queries but with the connection to the database. For instance with postgresql, I connect with user postgres and type the follwing command to list current connections:

select * from pg_stat_activity;

the result only displays one connection while it had to display at least two as one mut be used by named (a permanent connection according to the documentation).

The same thing happens with mysql, when I type:

show provcesslist;

I only get one connection. I believe that named does not connect to the database, but it does not diplsay any error message so that I can debug the issue.

> Date: Wed, 21 Mar 2012 13:28:16 -0700
> From: tlyons <at> ivenue.com
> To: bind-dlz-testers <at> lists.sourceforge.net
> Subject: Re: [Bind-dlz-testers] dlz ignores connection to postgres database
>
> 2012/3/21 data tanger <datatanger <at> hotmail.fr>:
> > Hi everyone,
> >
> > I tried to use the Bind Dlz driver but I can't get it to connect to the
> > database.When I start Bind, I don't see any error but I think it
> > ignores the connection to
> > the database.
> > I tried both Postgresql and Mysql with no success.
>
> First debugging step, enable query logging, or use tcpdump and dump
> the raw packets to see the query and the response.
>
> > Here's what I added to the named.conf file:
> >
> > dlz "PostgresZone" {
> > database "postgres
> > {host=localhost port=5432 dbname=dnsdb user=dnsuser}
> > {SELECT id FROM zones WHERE zone = lower('%zone%') LIMIT 1}
>
> You're returning the id from the query, when all of the examples (and
> my working config on mysql) return the zone field. Change that, see
> if it works.
>
> > {SELECT ttl, ttype, mx_priority, ddata FROM zones z, rrset r WHERE
> > z.id=r.zid
> > AND zone = lower('%zone%') AND host = lower('%record%') AND type NOT
> > IN('SOA','NS')}
> > {SELECT ttl, ttype, mx_priority, ddata, resp_person, serial, refresh,
> > retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid AND zone =
> > lower('%zone%') AND type IN('SOA','NS')}
> > {SELECT ttl, ttype, host, mx_priority, ddata, resp_person, serial,
> > refresh, retry, expire, minimum FROM zones z, rrset r WHERE z.id = r.zid
> > AND zone = lower('%zone%'}
> > {SELECT id FROM axfr WHERE zone = lower('%zone%' AND ip = '%client%'}";
>
> And in your xfer query, you're again returning the id instead of the zone field.
>
> > };
> >
> > Any help please?
>
> Try those and see what happens.
>
> ...Todd
>
> --
> Always code as if the guy who ends up maintaining your code will be a
> violent psychopath who knows where you live. -- Martin Golding
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Bind-dlz-testers mailing list
> Bind-dlz-testers <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bind-dlz-testers mailing list
Bind-dlz-testers <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
Todd Lyons | 22 Mar 2012 14:29
Gravatar

Re: dlz ignores connection to postgres database

2012/3/22 data tanger <datatanger <at> hotmail.fr>:
> My problem is not with queries but with the connection to the database. For
> instance with postgresql, I connect with user postgres and type the follwing
> command to list current connections:
>
> select * from pg_stat_activity;
>
> the result only displays one connection while it had to display at least two
> as one mut be used by named (a permanent connection according to the
> documentation).
>
> The same thing happens with mysql, when I type:
>
> show provcesslist;
>
> I only get one connection. I believe that named does not connect to the
> database, but it does not diplsay any error message so that I can debug the
> issue.

See if your binary actually has DLZ built into it:

[root <at> ivdns51 ~]# strings /usr/sbin/named | grep DLZ
Unregistering DLZ mysql driver.
Registering DLZ mysql driver.

On an older system, the binary was actually called named-sdb instead
of just named, but it hasn't been that way for a while now.

...Todd
--

-- 
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
data tanger | 22 Mar 2012 17:29
Picon
Favicon

Re: dlz ignores connection to postgres database

This the output of the command you showed me:

# strings /usr/sbin/named | grep -i DLZ
'--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-libtool' '--localstatedir=/var' '--enable-threads' '--enable-ipv6' '--with-pic' '--disable-static' '--disable-openssl-version-check' '--with-pkcs11=/usr/lib64/pkcs11/PKCS11_API.so' '--with-dlz-ldap=yes' '--with-dlz-postgres=yes' '--with-dlz-mysql=yes' '--with-dlz-filesystem=yes' '--with-gssapi=yes' '--disable-isc-spnego' 'CFLAGS= -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CPPFLAGS= -DDIG_SIGCHASE' 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'FFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu' 'target_alias=x86_64-redhat-linux-gnu'

I think the binaries I installed were built with dlz support. I have this version

# named -version
BIND 9.7.3-RedHat-9.7.3-1.el5




> Date: Thu, 22 Mar 2012 06:29:12 -0700
> From: tlyons <at> ivenue.com
> To: bind-dlz-testers <at> lists.sourceforge.net
> Subject: Re: [Bind-dlz-testers] dlz ignores connection to postgres database
>
> 2012/3/22 data tanger <datatanger <at> hotmail.fr>:
> > My problem is not with queries but with the connection to the database. For
> > instance with postgresql, I connect with user postgres and type the follwing
> > command to list current connections:
> >
> > select * from pg_stat_activity;
> >
> > the result only displays one connection while it had to display at least two
> > as one mut be used by named (a permanent connection according to the
> > documentation).
> >
> > The same thing happens with mysql, when I type:
> >
> > show provcesslist;
> >
> > I only get one connection. I believe that named does not connect to the
> > database, but it does not diplsay any error message so that I can debug the
> > issue.
>
> See if your binary actually has DLZ built into it:
>
> [root <at> ivdns51 ~]# strings /usr/sbin/named | grep DLZ
> Unregistering DLZ mysql driver.
> Registering DLZ mysql driver.
>
> On an older system, the binary was actually called named-sdb instead
> of just named, but it hasn't been that way for a while now.
>
> ...Todd
> --
> Always code as if the guy who ends up maintaining your code will be a
> violent psychopath who knows where you live. -- Martin Golding
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Bind-dlz-testers mailing list
> Bind-dlz-testers <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bind-dlz-testers mailing list
Bind-dlz-testers <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
Todd Lyons | 23 Mar 2012 15:54
Gravatar

Re: dlz ignores connection to postgres database

2012/3/22 data tanger <datatanger <at> hotmail.fr>
>
> This the output of the command you showed me:
>
> # strings /usr/sbin/named | grep -i DLZ
> '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu'
> '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr'
> '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
> '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
> '--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
> '--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
> '--infodir=/usr/share/info' '--with-libtool' '--localstatedir=/var'
> '--enable-threads' '--enable-ipv6' '--with-pic' '--disable-static'
> '--disable-openssl-version-check'
> '--with-pkcs11=/usr/lib64/pkcs11/PKCS11_API.so' '--with-dlz-ldap=yes'
> '--with-dlz-postgres=yes' '--with-dlz-mysql=yes' '--with-dlz-filesystem=yes'
> '--with-gssapi=yes' '--disable-isc-spnego' 'CFLAGS= -O2 -g -pipe -Wall
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic' 'CPPFLAGS= -DDIG_SIGCHASE'
> 'CXXFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 'FFLAGS=-O2
> -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic'
> 'build_alias=x86_64-redhat-linux-gnu' 'host_alias=x86_64-redhat-linux-gnu'
> 'target_alias=x86_64-redhat-linux-gnu'

That is really weird output, can you verify that you are in fact
looking at the binary and not some kind of compile time script?

[root <at> ivdns51 ~]# file /usr/sbin/named
/usr/sbin/named: ELF 64-bit LSB executable, AMD x86-64, version 1
(SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs),
for GNU/Linux 2.6.9, stripped

To be honest, I expect to see something like this:
[tlyons <at> ivwww01 ~/RPM/BUILD/bind-9.7.4-P1/bin/named]$ file named
named: Bourne shell script text executable

> I think the binaries I installed were built with dlz support. I have this
> version
>
> # named -version
> BIND 9.7.3-RedHat-9.7.3-1.el5

Basically the same version as my production system, though I'm rolling
out 9.7.4 next week to bring it current.

You said it doesn't even seem to connect to the database server.  What
happens when you do:

[root <at> ivdns51 ~]# netstat -t | grep -E ':(mysql|postgres)'
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:42760     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:37392
ivdb51.ivenue.net:mysql     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:57622     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:59702     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:42595
ivdns51.ivenue.net:mysql    ESTABLISHED
tcp        0     75 ivdns51.ivenue.net:mysql
ivdns51.ivenue.net:42595    ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:33662     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:33651     TIME_WAIT
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:42352     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:44150     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:57243     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:50076     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:57760     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:57530     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:41673     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:34543     ESTABLISHED
tcp        0      0 ivdns51.ivenue.net:mysql
ivwm51.ivenue.net:42747     ESTABLISHED

...Todd
--
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
data tanger | 24 Mar 2012 11:48
Picon
Favicon

Re: dlz ignores connection to postgres database



> That is really weird output, can you verify that you are in fact

I've downloaded the binaries from this website: http://www.bind9.net/download. Is there a better location where to donwload them from?

> looking at the binary and not some kind of compile time script?
>
> [root <at> ivdns51 ~]# file /usr/sbin/named
> /usr/sbin/named: ELF 64-bit LSB executable, AMD x86-64, version 1(SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
 
Here is my output:
[root <at> for1 ~]# file /usr/sbin/named
/usr/sbin/named: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, stripped


> To be honest, I expect to see something like this:
> [tlyons <at> ivwww01 ~/RPM/BUILD/bind-9.7.4-P1/bin/named]$ file named
> named: Bourne shell script text executable

> Basically the same version as my production system, though I'm rolling
> out 9.7.4 next week to bring it current.
> You said it doesn't even seem to connect to the database server. 

I wish I had some error message but none comes out. I think I'll try to remove it and reistall it again.

> What happens when you do:
>
> [root <at> ivdns51 ~]# netstat -t | grep -E ':(mysql|postgres)'
> tcp 0 0 ivdns51.ivenue.net:mysql ivwm51.ivenue.net:42760 ESTABLISHED


[root <at> for1 ~]# netstat -t | grep -E ':(mysql|postgres)'
tcp        0      0 open.zcornflowers.net:42157 67.228.173.2-stati:postgres TIME_WAIT


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bind-dlz-testers mailing list
Bind-dlz-testers <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
Rajiv | 30 Mar 2012 03:35

help

I want to use bind dlz with mysql backend for my ccTLD root server.  I have tried to configure in lab environment in centos 6, bind version 9.7.4-p1. My purpose to setup bind dlz with mysql backend to automate domain expiry in annual basis. Does bind dlz support ccTLD root server?

 

With best regards

rajiv

 

 

With best regards

rajiv

 

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Bind-dlz-testers mailing list
Bind-dlz-testers <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers
Todd Lyons | 30 Mar 2012 14:08
Gravatar

Re: help

2012/3/29 Rajiv <brajiv <at> mercantile.com.np>:
> I want to use bind dlz with mysql backend for my ccTLD root server.  I have
> tried to configure in lab environment in centos 6, bind version 9.7.4-p1. My
> purpose to setup bind dlz with mysql backend to automate domain expiry in
> annual basis. Does bind dlz support ccTLD root server?

IIRC, one issue that dlz had was with glue records.  Can you give an
example of something that you tried to configure that isn't doing what
you think it should?  Your config, table layout, and some sample data
will help us zero in on your issue.

...Todd
--

-- 
Always code as if the guy who ends up maintaining your code will be a
violent psychopath who knows where you live. -- Martin Golding

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure

Gmane