You can use mod_cluster with Tomcat 6+. Mod_cluster 1.2.1+ works good :-) Follow: http://docs.jboss.org/mod_cluster/1.2.0/html_single/
EDIT: [Scott Pack, Sep 24 at 17:01] was right, here you go:
Apache uses multicast for advertiding its presence to potential worker nodes. These worker nodes send messages to the Apache balancer. These messages contain available contexts, session settings and current load calculated on the worker node.
E.g.
Apache configuration:
<IfModule manager_module>
Listen mybox:8888
ManagerBalancerName mycluster
<VirtualHost mybox:8888>
<Location />
Order deny,allow
Deny from all
#Security concern...
Allow from all
</Location>
AdvertiseGroup 224.0.1.105:6666
EnableMCPMReceive
<Location /mcm>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
#Security concern :-)
Allow from all
</Location>
SSLEngine on
SSLCipherSuite AES128-SHA:ALL:!ADH:!LOW:!MD5:!SSLV2:!NULL
SSLCertificateFile /meh/httpd/certs/Server/server.crt
SSLCertificateKeyFile /meh/httpd/certs/Server/server.key
SSLCACertificateFile /meh/httpd/certs/Server/myca.crt
SSLVerifyClient require
SSLVerifyDepth 10
</VirtualHost>
</IfModule>
Tomcat6 configuration in server.xml:
<Listener
className="org.jboss.modcluster.container.catalina.standalone.ModClusterListener"
advertise="true"
advertiseGroupAddress="224.0.1.105"
advertisePort="6666"
stickySession="true"
stickySessionForce="false"
stickySessionRemove="true"
ssl="true"
sslKeyStorePass="tomcat"
sslKeyStore="/meh/tomcat6/certs/Client/test.p12"
sslKeyStoreType="PKCS12"
sslTrustStore="/meh/tomcat6/certs/Client/ca.p12"
sslTrustStoreType="PKCS12"
sslTrustStorePassword="tomcat"
loadMetricClass="org.jboss.modcluster.load.metric.impl.BusyConnectorsLoadMetric"
loadMetricCapacity="1"
loadHistory="9"
loadDecayFactor="2"
/>
The aforementioned Tomcat worker will:
- listen for balancer advertising and register with any balancer it finds
- use sticky sessions, yet failover to another worker is permitted (stickySessionForce="false")
- use ssl authentication with certificates (Apache<->SSL<->Tomcats)
- use BusyConnectorsLoadMetric, that basically measures number of threads being busy serving requests
HTH