I like this config for /etc/httpd/conf.d/proxy_ajp.conf:
<Proxy balancer://cluster-http>In the ProxySet lines we define basic values, the only one of which is interesting is timeout. This determines how long a device has to respond before it considered "down". Next we list the nodes, in this case three.
ProxySet lbmethod=bytraffic nofailover=on
ProxySet stickysession=JSESSIONID timeout=15
BalancerMember http://tomcat1:8080 \
retry=120 loadfactor=1
BalancerMember http://tomcat2:8080 \
retry=120 loadfactor=1
BalancerMember http://tomcat3:8080 \
retry=120 loadfactor=1 lbset=1
</Proxy>
ProxyPass /sample balancer://cluster-http/sample
Oddly, the timeout can be specified cluster-wide, but the retry, which specifies how often we check to see if "down" nodes are up, is listed individually. (It is possible to list timeout individually.) The loadfactor determines the weighting for each node.
The fun value is lbset. This one effectively allows the specification of a hotspare. In the above example, all "0" get hit all the time, and "1" gets no traffic. If all "0" nodes go down, "1" gets traffic.
Ready for sexy? Add this:
<Location /balancer-manager>Now you have an interactive, web based, management screen:
SetHandler balancer-manager
</Location>
ProxyPass /balancer-manager/ !
No comments:
Post a Comment