Thursday, April 09, 2009


Using Tomcat with mod_heartmonitor

httpd-trunk contains a logic to receive hearth beats for backend servers.
Associated with mod_proxy_balancer and the heartbeat Load balancing scheduler algorithm you can have a partially dynamic load balancing behaviour.
Configure httpd.conf with something like the following: (using httpd-trunk).

LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/
LoadModule proxy_balancer_module modules/
LoadModule heartmonitor_module modules/
LoadModule lbmethod_heartbeat_module modules/
LoadModule lbmethod_byrequests_module modules/

ProxyPass /myapp balancer://mycluster/myapp lbmethod=heartbeat
HeartbeatStorage logs/hb.dat

<Proxy balancer://mycluster>
BalancerMember ajp:// route=jfpc ping=10
BalancerMember ajp:// route=neo3 ping=10

Add the listener in server.xml of each tomcat: (using tc_trunk):

<Listener className="org.apache.catalina.ha.backend.HeartbeatListener" Port="8009"/>

Port is the Port of the AJP Connector where httpd is going to proxy the requests.

Start httpd and the Tomcats and have fun with the "dynamic" cluster.

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?