Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

OS: Ubuntu 12.04 LTS amd64
HTTP Server: Apache 2.2x
Tomcat: Apache 7.x
JVM: openJDK 1.7

We need to create a clustered Tomcat 7 environment. We have have been doing a lot of reading and need clarification on how to distinguish clusters from one another. We read about having mutliple clusters but we haven't seen a real example of how to configure multiple clusters.

For simplicity sake, how does one configure this environment?

Node 01 - Apache HTTP
  running mod_jk using load balancer

Node 02 - Tomcat Server
  running PROD application instance (Cluster PROD)
  running TEST application instance (Cluster TEST)
  running DEV application instance (Cluster DEV)

Node 03 - Tomcat Server
  running PROD application instance (Cluster PROD)
  running TEST application instance (Cluster TEST)
  running DEV application instance (Cluster DEV)

We don't want the session data to be shared between the different clusters. In other words, we don't want the PROD (Production) cluster information being shared with the TEST and DEV clusters (and vice-versa).

I think I understand that this statement in the server.xml is key to distinguishing each cluster instance. Please correct me if I am wrong:

<Membership
  className="org.apache.catalina.tribes.membership.McastService"
  address="228.0.0.4"
  port="45564" frequency="500"
  dropTime="3000"
/>

Therefore, do I just need to change the address field to something unique for each cluster? Example:

<!-- Cluster PROD -->
<Membership
  className="org.apache.catalina.tribes.membership.McastService"
  address="228.0.0.4"
  port="45564" frequency="500"
  dropTime="3000"
/>

<!-- Cluster TEST -->
<Membership
  className="org.apache.catalina.tribes.membership.McastService"
  address="228.0.0.5"
  port="45564" frequency="500"
  dropTime="3000"
/>

<!-- Cluster DEV -->
<Membership
  className="org.apache.catalina.tribes.membership.McastService"
  address="228.0.0.6"
  port="45564" frequency="500"
  dropTime="3000"
/>

Is there any other advice or gotcha's?

share|improve this question

migrated from webmasters.stackexchange.com Jul 12 '13 at 12:30

This question came from our site for pro webmasters.

2 Answers 2

up vote 2 down vote accepted

You need to read: http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

You've correctly identified the multicast IP address as the method by which clusters find out about members. You could also use different ports.

If you want a QA cluster and a production cluster, the easiest config is to have the QA cluster be on a separate multicast address/port combination the the production cluster.

share|improve this answer

Multiple clusters mean multiple Tomcat instances. In your case, node 02 and node 03 will be one cluster, you don't need to define another. So use only one Cluster tag (and with this, only one Membership tag is needed), and all three webapps' sessions will be synchronized between the tomcat instances (the webapps have to have the <distributable /> tag in their web.xml for this).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.