Bind 9.5.0 – Patch dlz MySQL 5 for auto reconnect

News, Tips Add comments

Here is a quick post of a “quick and dirty” patch for the ISC DNS Server : Bind 9.5.0a6 and its dlz mysql driver. For the quick story, I was using Bind 9.4.1 with dlz MySQL. My MySQL server is a 5.0.41 (with solidDB). While using it, I realize that some times the dns server was returning empty value for the dns queries. I tried many tips but it was still (sometime) giving me empty answer… Of course, I suspected the dlz driver. So, I tried to upgrade to Bind 9.5.0a6 but the problem still happened and the only way to fix was to restart bind !

So I take a look at the dlz driver and make this simple patch for adding the following features:

  • Set option MYSQL_OPT_RECONNECT to 1
  • Add some log error information while doing a ping

In fact, after using the few logs added thru mysql ping, I discover that when the driver lost its connection to the mysql server (due to a small wait_timeout, mysql restart, etc.) it tried to ping but didn’t succeed to reconnect to the server. Hopefully, I just needed to bypass the default option of MYSQL_OPT_RECONNECT while creating the connection.

MYSQL_OPT_RECONNECT

Enable or disable automatic reconnection to the server if the connection is found to have been lost. Reconnect has been off by default since MySQL 5.0.3; this option is new in 5.0.13 and provides a way to set reconnection behavior explicitly.

Now, I didn’t have to run a bloody crontab for checking that my dns server is still answering to its dns queries.

Enjoy. ;-)

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
blog comments powered by Disqus
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in