The first location you should take a look at is catalina.out, it will tell you what might be wrong.
If you can't make it works with multicast, just try static membership (I think it will simpler).
Below is my config:
Put the <Cluster node inside the <Host element:
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="192.168.5.149" port="4000" selectorTimeout="100" maxThreads="6"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor"> <Member className="org.apache.catalina.tribes.membership.StaticMember" port="4001" securePort="-1" host="192.168.5.199" domain="staging-cluster" uniqueId="{0,1,2,3,4,5,6,7,8,9}"/> </Interceptor> </Channel> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/usr/share/tomcat6/tempdir/" deployDir="/usr/share/tomcat6/webapps/" watchDir="/usr/share/tomcat6/watchdir/" watchEnabled="true"/> </Cluster> </Host> </Engine>
- The
address attribute in <Receiver element is the node1's IP address. (in your case is .101) - The
port is listening for replication messages on node 1 (4000-4100) - The
Member's port in <Interceptor is listening for cluster messages on node 2 - The
Member's host is the IP address of node 2 (.102)
server.xml on the node 2:
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"> <Channel className="org.apache.catalina.tribes.group.GroupChannel"> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="192.168.5.199" port="4001" selectorTimeout="100" maxThreads="6"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/> <Interceptor className="org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor"> <Member className="org.apache.catalina.tribes.membership.StaticMember" port="4000" securePort="-1" host="192.168.5.149" domain="staging-cluster" uniqueId="{0,1,2,3,4,5,6,7,8,9}"/> </Interceptor> </Channel> <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/usr/share/tomcat6/tempdir/" deployDir="/usr/share/tomcat6/webapps/" watchDir="/usr/share/tomcat6/watchdir/" watchEnabled="false"/> </Cluster>
Make sure that Tomcat can write to tempDir and watchDir folder:
chmod g+w tempDir watchDir chgrp tomcat tempDir watchDir
If you don't do this, you will get the below error:
Aug 13, 2011 10:28:33 PM org.apache.catalina.ha.deploy.FarmWarDeployer messageReceived SEVERE: Unable to read farm deploy file message. java.io.IOException: Permission denied
Remember to add <distributable/> into webapps/ROOT/WEB-INF/web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee" ... <display-name>Welcome to Tomcat</display-name> <description> Welcome to Tomcat </description> <distributable/> </web-app>
Whenever you copy a .war file into watchdir folder on node 1, you will see something like the following in catalina.out:
Aug 14, 2011 1:40:58 AM org.apache.catalina.ha.deploy.WarWatcher check INFO: check cluster wars at /usr/share/tomcat6/watchdir Aug 14, 2011 1:40:59 AM org.apache.catalina.ha.deploy.FarmWarDeployer fileModified INFO: Installing webapp[/cas] from /usr/share/tomcat6/webapps/cas.war Aug 14, 2011 1:40:59 AM org.apache.catalina.ha.deploy.FarmWarDeployer remove INFO: Cluster wide remove of web app /cas Aug 14, 2011 1:40:59 AM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive cas.war
and on the node 2:
Aug 14, 2011 1:40:59 AM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive cas.war
Good luck!