mysql client connection attempt to mysql server very slow

computer A with ip has mysql client on it and computer B with ip has the mysql server. mysql client on computer A try to connect to mysql server on computer B :
$ mysql -u username -p -h

it takes at least 5 seconds before mysql prompt show up on the screen after entering password. this can be a problem when computer A is hosting a web application which needs to read it’s database on compter B. page generation would take very long time even when a lot of bandwidth are available. the solution to this problem is very simple. open /etc/hosts file on computer B and add the ip of computer A like this :

save and exit. now the connection attemp should be faster and mysql prompt will show up on the screen in a second. this might be applied to other application too, like ssh for example.

Reblog this post [with Zemanta]

djbdns:put tinydns and dnscache on the same ip

one good thing that makes djbdns secure is the separation of dns-resolver (dnscache) and dns-server (tinydns).
but sometimes we want them to run on the same ip, for example when we set it up for internal use in our LAN.

a few tips to do so:

1. when configuring tinydns, make it listens on

$ tinydns-conf tinydns dnslog /etc/tinydns
$ ln -s /etc/tinydns /service

2. when configuring dnscache, make it listens on ip that you will tell all computers in your LAN to use it as the DNS server (eg.

$ dnscache-conf dnscache dnslog /etc/dnscachex
$ ln -s /etc/dncachex /service

3. all computers in your LAN will ask dnscache on to resolve a domain name. dnscache will then figure it out.
supposed that your tinydns is serving any domain ended with and all servers are in 192.168.1.* then you need to tell dnscache to ask tinydns for it:

$ echo “” > /etc/dnscachex/root/servers/
$ echo “” > /etc/dnscachex/root/servers/
$ svc -t /service/dnscachex

now dnscache will ask tinydns for any domain that ended with