Install httpd as service by following http://httpd.apache.org/docs/2.4/install.html
1) Edit /etc/httpd/conf/httpd.conf and change the Listen port to configure the Load balancer port. By default port will be 80.
2) Add a file lb.conf under /etc/httpd/conf.d to configure members to be redirected. httpd service will load all *.conf files present under /etc/httpd/conf.d folder.
3) lb.conf content example as below.
ProxyRequests off
<Proxy balancer://Testbalancer>
BalancerMember <URL1>
BalancerMember <URL2>
BalancerMember <URL3>
ProxySet lbmethod=byrequests Or ProxySet lbmethod=bybusyness Or lbmethod=bytraffic
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
</Location>
ProxyPass /balancer-manager !
ProxyPass / balancer://Testbalancer/ connectiontimeout=30 timeout=60
This will redirect all request http://<host>/ to either <URL1> or <URL2> or <URL3>
4) You can configure ProxyPass to redirect in case some specific string comes after the URL.
ProxyPass "/test" balancer://Testbalancer/ connectiontimeout=30 timeout=60
ProxyPassMatch "^/(.*\.gif)$" "http://backend.example.com/$1"
This will cause a local request for http://example.com/foo/bar.gif to be internally converted into a proxy request to http://backend.example.com/foo/bar.gif.
ProxyPassMatch "^/(.*\.gif)$" "http://backend.example.com:8000/$1"
Start/Stop/Restart service by : service httpd start/stop/restart
No comments:
Post a Comment
Thank You for your valuable comment