mysql client connection attempt to mysql server very slow

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

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 :
192.168.10.5 192.168.10.5

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 127.0.0.1

$ tinydns-conf tinydns dnslog /etc/tinydns 127.0.0.1
$ 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. 192.168.10.2)

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

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

$ echo “127.0.0.1” > /etc/dnscachex/root/servers/intra.net
$ echo “127.0.0.1” > /etc/dnscachex/root/servers/1.168.192.in-addr.arpa
$ svc -t /service/dnscachex

now dnscache will ask tinydns for any domain that ended with intra.net