Linux Cookbook

 < Day Day Up > 

24.13.1 Problem

You have redundant mail, FTP, or web servers, and you would like to configure them to automatically divide up the traffic load. For example, say you have a heavily trafficked web site that uses three separate redundant Apache servers. How do you make traffic automatically go to the least busy server?

24.13.2 Solution

DNS round-robin, or load balancing, is simple to implement. Just list all of your servers in /etc/tinydns/root/data:

+www.pixels.net:208.201.239.37:86400 +www.pixels.net:208.201.239.38:86400 +www.pixels.net:208.201.239.39:86400 @mail.pixels.net:208.201.239.37:a::86400 @mail.pixels.net:208.201.239.37:b::86400

24.13.3 Discussion

tinydns returns a set of up to eight random addresses for any single request. If any single server becomes unavailable, the client attempting to connect to the server will go on to the next one in line.

24.13.4 See Also

  • How to balance load among many web servers (http://cr.yp.to/djbdns/balance.html)

     < Day Day Up > 

    Категории