Re: dlz ignores connection to postgres database
data tanger <[email protected]> Thu, 22 Mar 2012 12:18:17 +0100
| Newsgroups | gmane.network.dns.bind9.dlz |
|---|---|
| Message-ID | <[email protected]> |
--===============6905720928457222381== Content-Type: multipart/alternative; boundary="_63615176-aa82-4d41-8d9d-09b5afa8320d_" --_63615176-aa82-4d41-8d9d-09b5afa8320d_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Thank you for your answer. I took the queries I put in my config file from = this book=20 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 conn= ection to the database. For instance with postgresql=2C I connect with user= postgres and type the follwing command to list current connections: select * from pg_stat_activity=3B the result only displays one connection while it had to display at least tw= o as one mut be used by named (a permanent connection according to the docu= mentation). The same thing happens with mysql=2C when I type: show provcesslist=3B I only get one connection. I believe that named does not connect to the dat= abase=2C but it does not diplsay any error message so that I can debug the = issue. > Date: Wed=2C 21 Mar 2012 13:28:16 -0700 > From: [email protected] > To: [email protected] > Subject: Re: [Bind-dlz-testers] dlz ignores connection to postgres databa= se >=20 > 2012/3/21 data tanger <[email protected]>: > > Hi everyone=2C > > > > I tried to use the Bind Dlz driver but I can't get it to connect to the > > database.When I start Bind=2C 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. >=20 > First debugging step=2C enable query logging=2C or use tcpdump and dump > the raw packets to see the query and the response. >=20 > > Here's what I added to the named.conf file: > > > > dlz "PostgresZone" { > > database "postgres > > {host=3Dlocalhost port=3D5432 dbname=3Ddnsdb user=3Ddnsuser} > > {SELECT id FROM zones WHERE zone =3D lower('%zone%') LIMIT 1} >=20 > You're returning the id from the query=2C when all of the examples (and > my working config on mysql) return the zone field. Change that=2C see > if it works. >=20 > > {SELECT ttl=2C ttype=2C mx_priority=2C ddata FROM zones z=2C rrset r WH= ERE > > z.id=3Dr.zid > > AND zone =3D lower('%zone%') AND host =3D lower('%record%') AND type NO= T > > IN('SOA'=2C'NS')} > > {SELECT ttl=2C ttype=2C mx_priority=2C ddata=2C resp_person=2C serial= =2C refresh=2C > > retry=2C expire=2C minimum FROM zones z=2C rrset r WHERE z.id =3D r.zid= AND zone =3D > > lower('%zone%') AND type IN('SOA'=2C'NS')} > > {SELECT ttl=2C ttype=2C host=2C mx_priority=2C ddata=2C resp_person=2C = serial=2C > > refresh=2C retry=2C expire=2C minimum FROM zones z=2C rrset r WHERE z.i= d =3D r.zid=09 > > AND zone =3D lower('%zone%'} > > {SELECT id FROM axfr WHERE zone =3D lower('%zone%' AND ip =3D '%client%= '}"=3B >=20 > And in your xfer query=2C you're again returning the id instead of the zo= ne field. >=20 > > }=3B > > > > Any help please? >=20 > Try those and see what happens. >=20 > ...Todd >=20 > --=20 > Always code as if the guy who ends up maintaining your code will be a > violent psychopath who knows where you live. -- Martin Golding >=20 > -------------------------------------------------------------------------= ----- > This SF email is sponsosred by: > Try Windows Azure free for 90 days Click Here=20 > http://p.sf.net/sfu/sfd2d-msazure > _______________________________________________ > Bind-dlz-testers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers = --_63615176-aa82-4d41-8d9d-09b5afa8320d_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <html> <head> <style><!-- .hmmessage P { margin:0px=3B padding:0px } body.hmmessage { font-size: 10pt=3B font-family:Tahoma } --></style></head> <body class=3D'hmmessage'><div dir=3D'ltr'> Thank you for your answer. I took the queries I put in my config file from = this book =3B <a href=3D"http://jpmens.net/2010/10/29/alternative-dns-servers-the-book-as= -pdf/">http://jpmens.net/2010/10/29/alternative-dns-servers-the-book-as-pdf= /</a> =3B<div>which I think is well explained.</div><div>My problem is = not with queries but with the connection to the database. For instance with= postgresql=2C I connect with user postgres and type the follwing command t= o list current connections:</div><div><br></div><div>select * from pg_stat_= activity=3B</div><div><br></div><div>the result only displays one connectio= n while it had to display at least two as one mut be used by named (a perma= nent connection according to the documentation).</div><div><br></div><div>T= he same thing happens with mysql=2C when I type:</div><div><br></div><div>s= how provcesslist=3B</div><div><br></div><div>I only get one connection. I b= elieve that named does not connect to the database=2C but it does not dipls= ay any error message so that I can debug the issue.<br><br><div><div id=3D"= SkyDrivePlaceholder"></div>>=3B Date: Wed=2C 21 Mar 2012 13:28:16 -0700<b= r>>=3B From: [email protected]<br>>=3B To: [email protected]= eforge.net<br>>=3B Subject: Re: [Bind-dlz-testers] dlz ignores connection= to postgres database<br>>=3B <br>>=3B 2012/3/21 data tanger <=3Bdata= [email protected]>=3B:<br>>=3B >=3B Hi everyone=2C<br>>=3B >=3B<b= r>>=3B >=3B I tried to use the Bind Dlz driver but I can't get it to co= nnect to the<br>>=3B >=3B database.When I start Bind=2C I don't see any= error but I think it<br>>=3B >=3B ignores the connection to<br>>=3B = >=3B the database.<br>>=3B >=3B I tried both Postgresql and Mysql wit= h no success.<br>>=3B <br>>=3B First debugging step=2C enable query log= ging=2C or use tcpdump and dump<br>>=3B the raw packets to see the query = and the response.<br>>=3B <br>>=3B >=3B Here's what I added to the na= med.conf file:<br>>=3B >=3B<br>>=3B >=3B dlz "PostgresZone" {<br>&g= t=3B >=3B database "postgres<br>>=3B >=3B {host=3Dlocalhost port=3D54= 32 dbname=3Ddnsdb user=3Ddnsuser}<br>>=3B >=3B {SELECT id FROM zones WH= ERE zone =3D lower('%zone%') LIMIT 1}<br>>=3B <br>>=3B You're returning= the id from the query=2C when all of the examples (and<br>>=3B my workin= g config on mysql) return the zone field. Change that=2C see<br>>=3B if = it works.<br>>=3B <br>>=3B >=3B {SELECT ttl=2C ttype=2C mx_priority= =2C ddata FROM zones z=2C rrset r WHERE<br>>=3B >=3B z.id=3Dr.zid<br>&g= t=3B >=3B AND zone =3D lower('%zone%') AND host =3D lower('%record%') AND= type NOT<br>>=3B >=3B IN('SOA'=2C'NS')}<br>>=3B >=3B {SELECT ttl= =2C ttype=2C mx_priority=2C ddata=2C resp_person=2C serial=2C refresh=2C<br= >>=3B >=3B retry=2C expire=2C minimum FROM zones z=2C rrset r WHERE z.i= d =3D r.zid AND zone =3D<br>>=3B >=3B lower('%zone%') AND type IN('SOA'= =2C'NS')}<br>>=3B >=3B {SELECT ttl=2C ttype=2C host=2C mx_priority=2C d= data=2C resp_person=2C serial=2C<br>>=3B >=3B refresh=2C retry=2C expir= e=2C minimum FROM zones z=2C rrset r WHERE z.id =3D r.zid <br>>=3B >=3B= AND zone =3D lower('%zone%'}<br>>=3B >=3B {SELECT id FROM axfr WHERE z= one =3D lower('%zone%' AND ip =3D '%client%'}"=3B<br>>=3B <br>>=3B And = in your xfer query=2C you're again returning the id instead of the zone fie= ld.<br>>=3B <br>>=3B >=3B }=3B<br>>=3B >=3B<br>>=3B >=3B Any = help please?<br>>=3B <br>>=3B Try those and see what happens.<br>>=3B= <br>>=3B ...Todd<br>>=3B <br>>=3B -- <br>>=3B Always code as if th= e guy who ends up maintaining your code will be a<br>>=3B violent psychop= ath who knows where you live. -- Martin Golding<br>>=3B <br>>=3B ------= ------------------------------------------------------------------------<br= >>=3B This SF email is sponsosred by:<br>>=3B Try Windows Azure free fo= r 90 days Click Here <br>>=3B http://p.sf.net/sfu/sfd2d-msazure<br>>=3B= _______________________________________________<br>>=3B Bind-dlz-testers= mailing list<br>>=3B [email protected]<br>>=3B ht= tps://lists.sourceforge.net/lists/listinfo/bind-dlz-testers<br></div></div>= </div></body> </html>= --_63615176-aa82-4d41-8d9d-09b5afa8320d_-- --===============6905720928457222381== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure --===============6905720928457222381== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Bind-dlz-testers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/bind-dlz-testers --===============6905720928457222381==--