Showing posts with label Apache mod_proxy_balancer. Show all posts
Showing posts with label Apache mod_proxy_balancer. Show all posts

Wednesday, August 19, 2015

Load balancer using Apache mod_proxy

First install Apache server. You can download it from http://httpd.apache.org/. For  this example  I have used  httpd-2.2.25-win32-x86-openssl-0.9.8. You can get it from Apache archive.


After  Apache installation complete, you might need to change the port 80 to some other port e.g 8000  if 80 port is block. You can change the port in httpd.conf file which located under   conf  folder.

Listen 8000

Bellow is an example how we can use mod_proxy_balancer to provide load balancing for three back-end server. You need to add following snippet at the bottom of the htttpd.conf. Then restart the server.

 
<Proxy balancer://mycluster>
BalancerMember http://localhost:9001
BalancerMember http://10.83.57.247:7001
BalancerMember http://wabothdk0544042:7001
</Proxy>
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/ 

Now if you open the URL http://localhost:8000 in browser, request will be forward to one of the back-end server. You can test it by looking server logs.