I am going to start a new website which is going to require DNS servers. It might have over 10,000 zones and will get more zone files as we get bigger. The problem is, which dns server software do you think is more efficent: mydns
which uses mysql to store the data or bind
which uses flat files? How do these DNS servers handle load balancing so we can balance the load between several servers so any one doesn't overload?
-
Wow I'd never heard of MyDNS before, looks interesting. A question like this will probably come down to history. BIND is old, trusted and reliable. There is also a huge amount of documenation and resorces about BIND. Similar to the way people would still chose to use Apache over say LIGHTTPD or NGINX, Apache is truested, even though it might not be the better solution – Smudge Jun 27 '11 at 13:33
-
Also I guess it comes down to how many records you're going to serve, storing 10k zones might require a good chunk of disk space, but if you only get one lookup a day, performance is probably irelevant. Do you know ~how many lookups there will be and are you distributing it over 2 or 3 DNS servers or just the one? – Smudge Jun 27 '11 at 13:34
-
Dup of: http://serverfault.com/questions/284484/choosing-between-bind-and-mydns – Ward - Reinstate Monica Jun 27 '11 at 13:38
-
Hey, each zone will have lots of lookups maybe even upto 100k but thats if when we get more popular and currenly the dns server will be run on one dedicated server but as we get more popular we are going to get couple of more dedicated servers and probably use round robin dns to balance the server load, I also dont want to migrate between the different dns servers hence why I want to choose the best one for me and the most effiecent one from the start. – Nesh A Jun 27 '11 at 13:49
-
2Have you excluded [djbdns](http://cr.yp.to/djbdns.html), [PowerDNS](http://powerdns.com/content/home-powerdns.aspx), [nsd](http://nlnetlabs.nl/projects/nsd/), and [MaraDNS](http://maradns.org/) from consideration? – JdeBP Jun 27 '11 at 13:55
-
no, but I want to know which system would be the most effiecent using databases or zone files, and which dns server is the most efficent. – Nesh A Jun 27 '11 at 14:09
-
2@Nesh, to heck with "most efficient", stick with the software you're most familiar with and which suits your other needs. The disk space for that many domains is almost trivial. I wouldn't worry how the software "handles load" so much as knowing you have enough CPU/RAM to handle spikes in traffic. Also, while you might expect to get to 12krps "if when we get more popular", you're probably better off sizing for your current load and scaling as you grow (dns scales very well). – Chris S Jun 28 '11 at 12:38
2 Answers
To my maind, BIND is better. It is easy to configure, you don't need to restart BIND except when you upgrade the software. What you should look into for BIND is the rndc command. Rndc allows you to reload an individual zone, while leaving BIND running. If you've edited the zonefile, rndc will publish the changes immediately.
It absolutely is possible for BIND to run off a database. You need to specify some steps in the ./configure step.
I have some good instructions but they are in russian. I'll try to write a little plan of action.
- It is assumed that MySQL-server already installed and configured.
- Download mysql-bind project from off. the site http://mysql-bind.sourceforge.net/ (there, we need two files: mysqldb.c and mysqldb.h).
Jump to the folder with the downloaded file to extract:
cd ~ / downloads / tar -xzf mysql-bind.tar.gz
Jump to the port and download the source bind9 (your version of mysql-bind is designed for this service). While not compile!
cd /usr/ports/dns/bind9 make fetch extract
Copy the downloaded files mysql-bind to bind's sources:
cp ~/downloads/mysqldb.c /usr/ports/dns/bind9/work/bind-x.x.x/bin/named/ cp ~/downloads/mysqldb.h /usr/ports/dns/bind9/work/bind-x.x.x/bin/named/include/named/
Jump to the folder with the source (work / bind-xxx) and make the following changes: a) The file bin/named/Makefile.in read:
DBDRIVER_OBJS = mysqldb.@O@ DBDRIVER_SRCS = mysqldb.c
Run the command
mysql_config -cflags
and write the output to a variableDBDRIVER_INCLUDES
(example:DBDRIVER_INCLUDES = -I/usr/local/include/mysql -fno-strict-aliasing -pipe
)Run the command
mysql_config -libs
and write the output to a variableDBDRIVER_LIBS
(example:DBDRIVER_LIBS = -L/usr/local/lib/mysql-lmysqlclient-lz-lcrypt-lm
)b) In the file
bin/named/main.c
:- Adding a header file #include
<named/mysqldb.h>
- Inside the function
setup()
, add a callmysqldb_init()
before the linens_server_create()
. - Inside the function
cleanup()
, add mysqldb_clear(); afterns_server_destroy()
.
- Adding a header file #include
Install Bind:
cd /usr/ports/dns/bind make make install
Create for each zone, its table mysql:
CREATE TABLE table_name ( name varchar(255) default NULL, ttl int(11) default NULL, rdtype varchar(255) default NULL, rdata varchar(255) default NULL ) TYPE=MyISAM;
Create the necessary records for the zone:
INSERT INTO table_name VALUES ('mydomain.com', 259200, 'SOA', 'mydomain.com. webmaster.mydomain.com. 2008092901 28800 7200 86400 28800'); INSERT INTO table_name VALUES ('mydomain.com', 259200, 'NS', 'ns0.mydomain.com.'); INSERT INTO table_name VALUES ('mydomain.com', 259200, 'NS', 'ns1.mydomain.com.'); INSERT INTO table_name VALUES ('mydomain.com', 259200, 'MX', '10 mail.mydomain.com.'); INSERT INTO table_name VALUES ('w0.mydomain.com', 259200, 'A', '192.168.1.1'); INSERT INTO table_name VALUES ('w1.mydomain.com', 259200, 'A', '192.168.1.2');
In the named.conf file prescribe the correct zone:
zone "smol.website.ru" { type master; notify no; database "mysqldb database_name table_name mysql_ip_address login password"; };
- Pay special attention, in the last line should specify the username and password. Information is stored in an unencrypted form, which of course is dangerous! So there are two ways: as something tricky to keep the code in the encoded code or in the database to create a user login-"bind" and pass-"bind" and put it privilege select.
- I apologize for my English. Hope this helps.
- the instruction is written for freebsd, for Linux should be similar
- 578
- 1
- 4
- 19
-
Would mysql database take more resources than zone files because I making a script and I would prefer to use database because its much easier to add records then opening file on php, and I have tried using mysql as a backend for bind but It never works, do you have a good tutorial that can guide me and thanks for your help? – Nesh A Jun 27 '11 at 14:03
http://mysql-bind.sourceforge.net/ will create tables for each zone you add, its really bad if you are going to host over 100k of zones.
- 1