Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
771 blopes 1
<!DOCTYPE html SYSTEM "about:legacy-compat">
2
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 Configuration Reference (9.0.112) - The Cluster object</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="../images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9 Configuration Reference</h1><div class="versionInfo">
3
            Version 9.0.112,
4
            <time datetime="2025-11-06">Nov 6 2025</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul></div><div><h2>Top Level Elements</h2><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul></div><div><h2>Executors</h2><ul><li><a href="executor.html">Executor</a></li></ul></div><div><h2>Connectors</h2><ul><li><a href="http.html">HTTP/1.1</a></li><li><a href="http2.html">HTTP/2</a></li><li><a href="ajp.html">AJP</a></li></ul></div><div><h2>Containers</h2><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul></div><div><h2>Nested Components</h2><ul><li><a href="cookie-processor.html">CookieProcessor</a></li><li><a href="credentialhandler.html">CredentialHandler</a></li><li><a href="globalresources.html">Global Resources</a></li><li><a href="jar-scanner.html">JarScanner</a></li><li><a href="jar-scan-filter.html">JarScanFilter</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="sessionidgenerator.html">SessionIdGenerator</a></li><li><a href="valve.html">Valve</a></li></ul></div><div><h2>Cluster Elements</h2><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul></div><div><h2>web.xml</h2><ul><li><a href="filter.html">Filter</a></li></ul></div><div><h2>Other</h2><ul><li><a href="runtime-attributes.html">Runtime attributes</a></li><li><a href="systemprops.html">System properties</a></li><li><a href="jaspic.html">JASPIC</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>The Cluster object</h2><h3 id="Table_of_Contents">Table of Contents</h3><div class="text">
5
<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Security">Security</a></li><li><a href="#Engine_vs_Host_placement">Engine vs Host placement</a></li><li><a href="#Context_Attribute_Replication">Context Attribute Replication</a></li><li><a href="#Nested_Components">Nested Components</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#SimpleTcpCluster_Attributes">SimpleTcpCluster Attributes</a></li></ol></li></ul>
6
</div><h3 id="Introduction">Introduction</h3><div class="text">
7
  <p>
8
  The tomcat cluster implementation provides session replication, context attribute replication and
9
  cluster wide WAR file deployment.
10
  While the <code>Cluster</code> configuration is fairly complex, the default configuration will work
11
  for most people out of the box. </p><p>
12
  The Tomcat Cluster implementation is very extensible, and hence we have exposed a myriad of options,
13
  making the configuration seem like a lot, but don't lose faith, instead you have a tremendous control
14
  over what is going on.</p>
15
</div><h3 id="Security">Security</h3><div class="text">
16
 
17
<p>The cluster implementation is written on the basis that a secure, trusted
18
network is used for all of the cluster related network traffic. It is not safe
19
to run a cluster on a insecure, untrusted network.</p>
20
 
21
<p>There are many options for providing a secure, trusted network for use by a
22
Tomcat cluster. These include:</p>
23
<ul>
24
  <li>private LAN</li>
25
  <li>a Virtual Private Network (VPN)</li>
26
  <li>IPSEC</li>
27
</ul>
28
 
29
<p>The <a href="cluster-interceptor.html#org.apache.catalina.tribes.group.interceptors.EncryptInterceptor_Attributes">EncryptInterceptor</a>
30
provides confidentiality and integrity protection but it does not protect
31
against all risks associated with running a Tomcat cluster on an untrusted
32
network, particularly DoS attacks.</p>
33
 
34
</div><h3 id="Engine_vs_Host_placement">Engine vs Host placement</h3><div class="text">
35
  <p>
36
   You can place the <code>&lt;Cluster&gt;</code> element inside either the <code>&lt;Engine&gt;</code>
37
   container or the <code>&lt;Host&gt;</code> container.<br>
38
   Placing it in the engine, means that you will support clustering in all virtual hosts of Tomcat,
39
   and share the messaging component. When you place the <code>&lt;Cluster&gt;</code> inside the <code>&lt;Engine&gt;</code>
40
   element, the cluster will append the host name of each session manager to the managers name so that two contexts with
41
   the same name but sitting inside two different hosts will be distinguishable.
42
  </p>
43
</div><h3 id="Context_Attribute_Replication">Context Attribute Replication</h3><div class="text">
44
  <p>To configure context attribute replication, simply do this by swapping out the context implementation
45
  used for your application context.</p>
46
  <div class="codeBox"><pre><code>&lt;Context className="org.apache.catalina.ha.context.ReplicatedContext"/&gt;</code></pre></div>
47
  <p>
48
    This context extends the Tomcat <code><a href="context.html">StandardContext</a></code>
49
    so all the options from the <a href="context.html">base implementation</a> are valid.
50
  </p>
51
</div><h3 id="Nested_Components">Nested Components</h3><div class="text">
52
  <p><b><a href="cluster-manager.html">Manager</a>:</b> <br>
53
    The session manager element identifies what kind of session manager is used in this cluster implementation.
54
    This manager configuration is identical to the one you would use in a regular <code><a href="context.html#Nested_Components">&lt;Context&gt;</a></code> configuration.
55
    <br>The default value is the <code>org.apache.catalina.ha.session.DeltaManager</code> that is closely coupled with
56
    the <code>SimpleTcpCluster</code> implementation. Other managers like the <code>org.apache.catalina.ha.session.BackupManager</code>
57
    are/could be loosely coupled and don't rely on the <code>SimpleTcpCluster</code> for its data replication.
58
  </p>
59
  <p><b><a href="cluster-channel.html">Channel</a>:</b> <br>
60
    The Channel and its sub components are all part of the IO layer
61
    for the cluster group, and is a module in it's own that we have nick named "Tribes"
62
    <br>
63
    Any configuring and tuning of the network layer, the messaging and the membership logic
64
    will be done in the channel and its nested components.
65
    You can always find out more about <a href="../tribes/introduction.html">Apache Tribes</a>
66
  </p>
67
  <p><b><a href="cluster-valve.html">Valve</a>:</b> <br>
68
    The Tomcat Cluster implementation uses <code>Tomcat <a href="valve.html">Valves</a></code> to
69
    track when requests enter and exit the servlet container. It uses these valves to be able to make
70
    intelligent decisions on when to replicate data, which is always at the end of a request.
71
  </p>
72
  <p><b><a href="cluster-deployer.html">Deployer</a>:</b> <br>
73
    The Deployer component is the Tomcat Farm Deployer. It allows you to deploy and undeploy applications
74
    cluster wide.
75
  </p>
76
  <p><b><a href="cluster-listener.html">ClusterListener</a>:</b> <br>
77
    ClusterListener's are used to track messages sent and received using the <code>SimpleTcpCluster</code>.
78
    If you wish to track messages, you can add a listener here, or you can add a valve to the channel object.
79
  </p>
80
</div><h3 id="Attributes">Attributes</h3><div class="text">
81
  <div class="subsection"><h4 id="SimpleTcpCluster_Attributes">SimpleTcpCluster Attributes</h4><div class="text">
82
  <table class="defaultTable"><tr><th style="width: 15%;">
83
          Attribute
84
        </th><th style="width: 85%;">
85
          Description
86
        </th></tr><tr id="Attributes_SimpleTcpCluster Attributes_className"><td><strong><code class="attributeName">className</code></strong></td><td>
87
      <p>The main cluster class, currently only one is available,
88
         <code>org.apache.catalina.ha.tcp.SimpleTcpCluster</code>
89
      </p>
90
    </td></tr><tr id="Attributes_SimpleTcpCluster Attributes_channelSendOptions"><td><strong><code class="attributeName">channelSendOptions</code></strong></td><td>
91
      <p>The Tribes channel send options, default is <code>8</code>.<br>
92
         This option is used to set the flag that all messages sent through the
93
         SimpleTcpCluster uses. The flag decides how the messages are sent, and is a simple logical OR.</p>
94
 
95
      <div class="codeBox"><pre><code>int options = Channel.SEND_OPTIONS_ASYNCHRONOUS |
96
              Channel.SEND_OPTIONS_SYNCHRONIZED_ACK |
97
              Channel.SEND_OPTIONS_USE_ACK;</code></pre></div>
98
      <p>Some of the values are:<br>
99
      <code>Channel.SEND_OPTIONS_SYNCHRONIZED_ACK = 0x0004</code><br>
100
      <code>Channel.SEND_OPTIONS_ASYNCHRONOUS = 0x0008</code><br>
101
      <code>Channel.SEND_OPTIONS_USE_ACK = 0x0002</code><br>
102
      So to use ACK and ASYNC messaging, the flag would be <code>10</code> (8+2)
103
      <br>
104
      Note that if you use ASYNC messaging it is possible for update messages
105
      for a session to be processed by the receiving nodes in a different order
106
      to the order in which they were sent.
107
      </p>
108
      <p>
109
        The various <code>channelSendOptions</code> values offer a tradeoff
110
        between throughput on the sending node and the reliability of
111
        replication should the sending or receiving node(s) fail. Here are
112
        some common options. "Message" could be any message sent between nodes,
113
        but only session-change messages are considered, here.
114
      </p>
115
      <p>
116
        <code>channelSendOptions="8"</code> / <code>channelSendOptions="async"</code>
117
        As far as the sender is concerned, the message is "sent"
118
        as soon as it has been placed in the queue on the sender for
119
        transmission to the other nodes. The message may not reach any or all
120
        of the recipient nodes and may not be successfully processed on any
121
        nodes that it does reach. This option offers the highest throughput on
122
        the sender but the least reliability, as the triggering request will
123
        complete without any knowledge of the success/failure of the session
124
        replication.
125
      </p>
126
      <p>
127
        <code>channelSendOptions="2"</code> / <code>channelSendOptions="use_ack"</code>
128
        The sender will block the completion of the current request until all
129
        of the receiving nodes have acknowledged that they have received the
130
        message, but have not necessarily processed that message. This option
131
        will result in lower throughput on the sending node, because the message
132
        must be transmitted and the acknowledgement received, but the
133
        reliability is greater than the asynchronous model.
134
      </p>
135
      <p>
136
        <code>channelSendOptions="6"</code> / <code>channelSendOptions="sync,use_ack"</code>
137
        The sender will block the completion of the current request until
138
        all of the receiving nodes have acknowledged that they have received
139
        <u>and</u> processed the message. This option will have the lowest
140
        throughput (of these three) but the greatest reliability.
141
      </p>
142
      <p>
143
      You may also set these options as a comma separated string, e.g. "async, multicast", which
144
      will be translated into <code>Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST</code>
145
      <br>
146
      The valid option names are "asynchronous" (alias "async"), "byte_message" (alias "byte")
147
      , "multicast", "secure", "synchronized_ack" (alias "sync"), "udp", "use_ack"
148
      </p>
149
    </td></tr><tr id="Attributes_SimpleTcpCluster Attributes_channelStartOptions"><td><code class="attributeName">channelStartOptions</code></td><td>
150
      <p>Sets the start and stop flags for the &lt;Channel&gt; object used by the cluster.
151
         The default is <code>Channel.DEFAULT</code> which starts all the channel services, such as
152
         sender, receiver, membership sender and membership receiver.
153
         The following flags are available today:</p>
154
         <div class="codeBox"><pre><code>Channel.DEFAULT = Channel.SND_RX_SEQ (1) |
155
                  Channel.SND_TX_SEQ (2) |
156
                  Channel.MBR_RX_SEQ (4) |
157
                  Channel.MBR_TX_SEQ (8);</code></pre></div>
158
      <p>When using the static membership service
159
      <code>org.apache.catalina.tribes.membership.StaticMembershipService</code>
160
      you must ensure that this attribute is configured to use the default
161
      value.</p>
162
    </td></tr><tr id="Attributes_SimpleTcpCluster Attributes_heartbeatBackgroundEnabled"><td><code class="attributeName">heartbeatBackgroundEnabled</code></td><td>
163
      <p>Flag whether invoke channel heartbeat at container background thread. Default value is false.
164
         Enable this flag don't forget to disable the channel heartbeat thread.
165
      </p>
166
    </td></tr><tr id="Attributes_SimpleTcpCluster Attributes_notifyLifecycleListenerOnFailure"><td><code class="attributeName">notifyLifecycleListenerOnFailure</code></td><td>
167
      <p>Flag whether notify LifecycleListeners if all ClusterListener couldn't accept channel message.
168
         Default value is false.
169
      </p>
170
    </td></tr></table>
171
  </div></div>
172
</div></div></div></div></div><footer><div id="footer">
173
    Copyright &copy; 1999-2025, The Apache Software Foundation
174
    <br>
175
    Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo
176
    are either registered trademarks or trademarks of the Apache Software
177
    Foundation.
178
    </div></footer></div></body></html>