There are many ways to do this. The simplest one is DNS Round-Robin
Say you have a website abc.com and you want to load balance its traffic with 3 servers.
Use the BIND, it is installed by default in almost every Linux distribution.
wwwabc1 IN A x.x.x.1
wwwabc2 IN A x.x.x.2
wwwabc3 IN A x.x.x.3
just configure web server wwwtest1/wwwtest2/wwwtest3 as you do in your DNS.
Then you need to add the below entry for load balancing.
www IN A x.x.x.1
www IN A x.x.x.2
www IN A x.x.x.3
Now the DNS will load balance the traffic across the 3 servers.
Though it is not the best way to do the load balance but it works fine and you can get good results.
You can do that Via Apache Web Server as well by the help of mod_rewrite and its proxy throughput feature. lbnamed is a good program for this job
for this , add the below line in DNS.
www IN CNAME wwwabc1.abc.com.
Then configure this machine so all arriving URLs are just pushed through the internal proxy to one of the three other servers wwwabc1/wwwabc2/wwwabc3.
The below rule set will do the job.
RewriteEngine on
RewriteMap lb prg:/path/to/lb.pl
RewriteRule ^/(.+)$ ${lb:$1} [P,L]
There is a script given for this at http://www.stanford.edu/manual/rewrite/rewrite_guide_advanced.html
No comments:
Post a Comment