DNS Loadbalancing & Failover?
November 25th, 2008
For now I’m looking for an easy way to set up DNS loadbalancing with basic failover capabilities. The first thing you find on big G is MyDNS, an ageing DNS server that serves DNS records from a MySQL database. Setup is easily done the debian way, adding records with PHPMyAdmin takes its time but is no big problem and it is also not a big deal to set up a secondary NS when simply using MySQL replication. The only thing I don’t understand is the stupid weighting algorithm. It would have been so much better to implement something that is not unpredictable. Seems to become some fun to figure this out, hah. Anyway, I already set up a primary/secondary DNS with the most important records for a bunch of zones so that I am in need of a domain hosting company that enables me to define own NS entries. We will see and I will continue on this as soon as I have learned my lessons :-).
Update: Lesson 1: in-addr.arpa SOAs seem to require some kind of mask -> 0/7.111.133.213.in-addr.arpa. works but I have no idea what this is all about. I guess: 0-255 for fixed bits in the last byte? Or is it a real netmask? Heh? ^^
Update: Lesson 2: Ok, a big IN-ADDR.ARPA. SOA suffices and holds all the reverse records. So I don’t need to think about the mask anymore :-).
Update: Lesson 3: MyDNS comes with an administration interface written in PHP. It’s broken in conjunction with PHP 5.2.0 but changing only two lines of code fixes this (change $this to something else on line 2484 and 2485). Seems to be quite nice.
Another DNS server capable of using MySQL as a backend is PowerDNS, but this seems to be just too much for my needs. There even is commercial support available what definitely turns me off. => When MyDNS does not work out, I’ll try it.
And yeah, you are right, I implemented the DNS protocol on my own on top of Apache Mina not long ago exactly for this task but as there does not seem to be any interest in neither AsyncFCGI nor AsyncDNS, there is currently no motivation left to carry on the work. However, it has been some fun and you are still free to become interested ;-).
Happy coding!
Update: Ok, I tried out MyDNS and PowerDNS now. Both of them come with everything, a good DNS server needs. In detail: PowerDNS comes with much more advanced stuff like multiple backends, master/slave configuration etc. and has got a nice documentation about every aspect of the server. However, it is more complicated than MyDNS because of this. I like the administration interface shipped with MyDNS because it is really easy to understand, while PowerAdmin for PowerDNS will get frustrating over time. However, both servers don’t really satisfy me, so I may continue my own stuff or at least create a modern admin UI for one of them when I find the time. Stay tuned! :-)

January 21st, 2009 at 03:42
thanks for that hint about mydns and php 5.2