Clustering LAMS 2
This page is a collection of notes on clustering LAMS 2. This mainly means clustering as jboss4 supports it, and associated notes regarding running LAMS in this way. Clustering the database backend (e.g. MySQL), or the underlying operating/file system, is not discussed on this page.
JBoss chapter 16 on clustering for jboss4: http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html
JBoss forum on clustering: http://www.jboss.com/index.html?module=bb&op=viewforum&f=64
Running LAMS across separate nodes means you will need a common path for the various path parameters, like the content repository, and lams-www.war. This could possibly be resolved by using a network share, as well as a symbolic link in the case of the lams-www.war.
Here are the settings I found to work while testing LAMS 2 as it was in May 2006 (code has changed since then). I used Apache+mod_jk as the (software) load balancer as suggested by the jboss documentation (simple free solution).
- Begin by deploying lams as normal - but note the following additional configuration for each jboss node:
- Deploy lams into $JBOSS_HOME/server/all/deploy/, rather than $JBOSS_HOME/server/default/deploy. The 'all' configuration contains the cluster configuration (I think you can deploy to default if you copy over the tc5-cluster-service.xml in addition to the jboss-groups and jcache.jar from all).
- In $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/server.xml, add the jvmRoute parameter to the Engine element: Name each of your jboss nodes a different name, e.g. node1, node2, node3...
- In $JBOSS_HOME/server/all/deploy/jbossweb-tomcat55.sar/META-INF/jboss-service.xml, set UseJK to true
- In $JBOSS_HOME/server/all/deploy/tc5-cluster-service.xml, setup various cluster parameters including ClusterName. See jboss documentation for more details - I left these at default.
One machine had Apache installed acting as the load balancer for the cluster via mod_jk. Follow the instructions at http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html#clustering-http-modjk to setup Apache to talk to each of the nodes. Note the following:
- In $APACHE_HOME/conf/workers.properties, enable session stickyness. I couldn't get failover to work without lams throwing errors, so this had to be set sticky. Might be worth trying again since code has changed since May 2006.
- When starting up each node, make sure to bind each node to its IP:
That's it. With this configuration users will be directed to different jboss nodes in round-robin fashion, and remain using that node during their session. They will lose their session if that particular node goes down (sticky bit).