Tuesday, April 14, 2009

 

Using Tomcat with mod_heartmonitor (part 2)

This is the second blog on the topic using Tomcat with mod_heartmonitor, here it is using HTTP instead multicast sockets... Well no one like multicast sockets but everyone likes the HTTP protocol no?
In the httpd.conf file add something like the following (to the httpd.conf the previous blog):


<Location /HeartbeatListener>
SetHandler hearthbeat
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from 10.33.144.4
</Location>


In the server.xml add ProxyList to the HeartbeatListener:


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


Have fun!!!

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/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule heartmonitor_module modules/mod_heartmonitor.so
LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so

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

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

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.

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