mod_proxy_balancer requires the service of mod_proxy, and it provides load balancing for all the supported protocols.
mod_proxy_balancer has following scheduling algorithm
- mod_lbmethod_byrequests
- mod_lbmethod_bytraffic
- mod_lbmethod_bybusyness
- mod_lbmethod_heartbeat
Followings are the example of a balancer configuration:
<Proxy "balancer://mycluster">
BalancerMember "http://192.168.1.50:80"
BalancerMember "http://192.168.1.51:80"
</Proxy>
ProxyPass "/test" "balancer://mycluster"
ProxyPassReverse "/test" "balancer://mycluster"
Followings are another example of balancer configuration:
<VirtualHost *:80>
ServerName cdn.its-newid.net
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
<Proxy *>
Require all granted
</Proxy>
<Proxy balancer://mycluster>
BalancerMember http://192.168.10.7:80 route=1 connectiontimeout=1
BalancerMember http://192.168.10.8:80 route=2 connectiontimeout=1
ProxySet lbmethod=byrequests
ProxySet stickysession=ROUTEID
</Proxy>
ProxyPass "/" "balancer://mycluster"
ProxyPassReverse "/" "balancer://mycluster"
DocumentRoot "/pub/cdn.qsok.com/"
CustomLog /var/log/httpd/cdn.its-newid.net-access.log combined
ErrorLog /var/log/httpd/cdn.its-newid.net-error.log
</VirtualHost>