The Tomcat cluster.xml source code
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE document [
<!ENTITY project SYSTEM "project.xml">
]>
<document url="cluster.html">
&project;
<properties>
<author email="fhanik@apache.org">Filip Hanik
<title>The Cluster object
</properties>
<body>
<section name="Introduction">
<p>
The tomcat cluster implementation provides session replication, context attribute replication and
cluster wide WAR file deployment.
While the <code>Cluster configuration is fairly complex, the default configuration will work
for most people out of the box. </p>
The Tomcat Cluster implementation is very extensible, and hence we have exposed a myriad of options,
making the configuration seem like a lot, but don't lose faith, instead you have a tremendous control
over what is going on.</p>
</section>
<section name="Engine vs Host placement">
<p>
You can place the <code><Cluster> element inside either the <Engine>
container or the <code><Host> container.
Placing it in the engine, means that you will support clustering in all virtual hosts of Tomcat,
and share the messaging component. When you place the <code><Cluster> inside the <Engine>
element, the cluster will append the host name of each session manager to the managers name so that two contexts with
the same name but sitting inside two different hosts will be distinguishable.
</p>
</section>
<section name="Context Attribute Replication">
<p>To configure context attribute replication, simply do this by swapping out the context implementation
used for your application context.
<source><Context className="org.apache.catalina.ha.context.ReplicatedContext"/>
This context extends the Tomcat <code>StandardContext
so all the options from the <a href="context.html">base implementation are valid.
</p>
</section>
<section name="Nested Components">
<p>Manager:
The session manager element identifies what kind of session manager is used in this cluster implementation.
This manager configuration is identical to the one you would use in a regular <code><Context> configuration.
<br/>The default value is the org.apache.catalina.ha.session.DeltaManager
that is closely coupled with
the <code>SimpleTcpCluster implementation. Other managers like the org.apache.catalina.ha.session.BackupManager
are/could be loosely coupled and don't rely on the <code>SimpleTcpCluster for its data replication.
</p>
<p>Channel:
The Channel and its sub components are all part of the IO layer
for the cluster group, and is a module in it's own that we have nick named "Tribes"
<br/>
Any configuring and tuning of the network layer, the messaging and the membership logic
will be done in the channel and its nested components.
You can always find out more about <a href="../tribes/introduction.html">Apache Tribes
</p>
<p>Valve:
The Tomcat Cluster implementation uses <code>Tomcat Valves to
track when requests enter and exit the servlet container. It uses these valves to be able to make
intelligent decisions on when to replicate data, which is always at the end of a request.
</p>
<p>Deployer:
The Deployer component is the Tomcat Farm Deployer. It allows you to deploy and undeploy applications
cluster wide.
</p>
<p>ClusterListener:
ClusterListener's are used to track messages sent and received using the <code>SimpleTcpCluster.
If you wish to track messages, you can add a listener here, or you can add a valve to the channel object.
</p>
</section>
<section name="Deprecated configuration options">
<p>
<b>Deprecated settings: In the previous version of Tomcat you were able to control session
manager settings using manager.<property>=value.
This has been discontinued, as the way it was written interfers with
the ability to support multiple different manager classes under one cluster implementation,
as the same properties might have the different effect on different managers.
</p>
</section>
<section name="Attributes">
<subsection name="SimpleTcpCluster Attributes">
<attributes>
<attribute name="className" required="true">
<p>The main cluster class, currently only one is available,
<code>org.apache.catalina.ha.tcp.SimpleTcpCluster
</p>
</attribute>
<attribute name="channelSendOptions" required="true">
<p>The Tribes channel send options, default is 8
.
This option is used to set the flag that all messages sent through the
SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.<br/>
<source>
int options= Channel.SEND_OPTIONS_ASYNCHRONOUS |
Channel.SEND_OPTIONS_SYNCHRONIZED_ACK |
Channel.SEND_OPTIONS_USE_ACK;
</source>
Some of the values are:<br/>
<code>Channel.SEND_OPTIONS_SYNCHRONIZED_ACK = 0x0004
<code>Channel.SEND_OPTIONS_ASYNCHRONOUS = 0x0008
<code>Channel.SEND_OPTIONS_USE_ACK = 0x0002
So to use ACK and ASYNC messaging, the flag would be <code>10 (8+2) or 0x000B
</p>
</attribute>
<attribute name="heartbeatBackgroundEnabled" required="false">
<p>Enable this flag don't forget to disable the channel heartbeat thread.
</p>
</attribute>
<attribute name="doClusterLog" required="false">
<p>Deprecated since 6.0.0
<p>Possible values are true
or false
Value is inherited from Tomcat 5.5 and has no official meaning.
to configure logging, use the standard tomcat logging configuration.
</p>
</attribute>
<attribute name="clusterLogName" required="false">
<p>Deprecated since 6.0.0
<p>
Value is inherited from Tomcat 5.5 and has no official meaning.
to configure logging, use the standard tomcat logging configuration.
</p>
</attribute>
</attributes>
</subsection>
</section>
</body>
</document>
Other Tomcat examples (source code examples)
Here is a short list of links related to this Tomcat cluster.xml source code file: