<commit_before><?xml version="1.0"?>
<!DOCTYPE document [
  <!ENTITY project SYSTEM "project.xml">
]>
<document url="cluster-howto.html">

    &project;

    <properties>
        <author email="<EMAIL>"><NAME></author>
        <author email="<EMAIL>"><NAME></author>
        <title>Clustering/Session Replication HOW-TO</title>
    </properties>

<body>


<section name="Important Note">
<p><b>This document is pending an update to the latest implementation.<br/>
   You can also check the <a href="config/cluster.html">configuration reference documentation.</a></b>
</p>
</section>

<section name="For the impatient">
  <p>
    Simply add <source>&lt;Cluster className=&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;/&gt;</source>
    to your <code>&lt;Engine&gt;</code> or your <code>&lt;Host&gt;</code> element to enable clustering.
  </p>
  <p>
    Using the above configuration will enable all to all session replication
    using the <code>DeltaManager</code> to replicate session deltas.<br/>
    Here are some of the important default values:<br/>
    1. Multicast address is 172.16.58.3<br/>
    2. Multicast port is 45564<br/>
    3. The IP broadcasted is <code>java.net.InetAddress.getLocalHost().getHostAddress()</code><br/>
    4. The TCP port listening for replication messages is the first available server socket in range <code>4000-4100</code><br/>
    5. Two listeners are configured <code>ClusterSessionListener</code> and <code>JvmRouteSessionIDBinderListener</code><br/>
    6. Two interceptors are configured <code>TcpFailureDetector</code> and <code>MessageDispatch15Interceptor</code><br/>
    The following is the default cluster configuration:<br/>
    <source>
        &lt;Cluster className=&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;
                 channelSendOptions=&quot;8&quot;&gt;

          &lt;Manager className=&quot;org.apache.catalina.ha.session.DeltaManager&quot;
                   expireSessionsOnShutdown=&quot;false&quot;
                   notifyListenersOnReplication=&quot;true&quot;/&gt;

          &lt;Channel className=&quot;org.apache.catalina.tribes.group.GroupChannel&quot;&gt;
            &lt;Membership className=&quot;org.apache.catalina.tribes.membership.McastService&quot;
                        address=&quot;172.16.58.3&quot;
                        port=&quot;45564&quot;
                        frequency=&quot;500&quot;
                        dropTime=&quot;3000&quot;/&gt;
            &lt;Receiver className=&quot;org.apache.catalina.tribes.transport.nio.NioReceiver&quot;
                      address=&quot;auto&quot;
                      port=&quot;4000&quot;
                      selectorTimeout=&quot;5000&quot;
                      maxThreads=&quot;6&quot;/&gt;

            &lt;Sender className=&quot;org.apache.catalina.tribes.transport.ReplicationTransmitter&quot;&gt;
              &lt;Transport className=&quot;org.apache.catalina.tribes.transport.nio.PooledParallelSender&quot;/&gt;
            &lt;/Sender&gt;
            &lt;Interceptor className=&quot;org.apache.catalina.tribes.group.interceptors.TcpFailureDetector&quot;/&gt;
            &lt;Interceptor className=&quot;org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor&quot;/&gt;
          &lt;/Channel&gt;

          &lt;Valve className=&quot;org.apache.catalina.ha.tcp.ReplicationValve&quot;
                 filter=&quot;.*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;&quot;/&gt;

          &lt;Deployer className=&quot;org.apache.catalina.ha.deploy.FarmWarDeployer&quot;
                    tempDir=&quot;/tmp/war-temp/&quot;
                    deployDir=&quot;/tmp/war-deploy/&quot;
                    watchDir=&quot;/tmp/war-listen/&quot;
                    watchEnabled=&quot;false&quot;/&gt;

          &lt;ClusterListener className=&quot;org.apache.catalina.ha.session.ClusterSessionListener&quot;/&gt;
          &lt;ClusterListener className=&quot;org.apache.catalina.ha.session.ClusterSessionListener&quot;/&gt;
        &lt;/Cluster&gt;    
    </source>
  </p>
</section>

<section name="Cluster Basics">

<p>To run session replication in your Tomcat 6.0 container, the following steps
should be completed:</p>
<ul>
<li>All your session attributes must implement <code>java.io.Serializable</code></li>
<li>Uncomment the <code>Cluster</code> element in server.xml</li>
<li>Uncomment the <code>Valve(ReplicationValve)</code> element in server.xml</li>
<li>If your Tomcat instances are running on the same machine, make sure the <code>tcpListenPort</code>
    attribute is unique for each instance.</li>
<li>Make sure your <code>web.xml</code> has the <code>&lt;distributable/&gt;</code> element 
    or set at your <code>&lt;Context distributable="true" /&gt;</code></li>
<li>If you are using mod_jk, make sure that jvmRoute attribute is set at your Engine <code>&lt;Engine name="Catalina" jvmRoute="node01" &gt;</code>
    and that the jvmRoute attribute value matches your worker name in workers.properties</li>
<li>Make sure that all nodes have the same time and sync with NTP service!</li>
<li>Make sure that your loadbalancer is configured for sticky session mode.</li><commit_msg>corrected defaults<commit_after><?xml version="1.0"?>
<!DOCTYPE document [
  <!ENTITY project SYSTEM "project.xml">
]>
<document url="cluster-howto.html">

    &project;

    <properties>
        <author email="<EMAIL>"><NAME></author>
        <author email="<EMAIL>"><NAME></author>
        <title>Clustering/Session Replication HOW-TO</title>
    </properties>

<body>


<section name="Important Note">
<p><b>This document is pending an update to the latest implementation.<br/>
   You can also check the <a href="config/cluster.html">configuration reference documentation.</a></b>
</p>
</section>

<section name="For the impatient">
  <p>
    Simply add <source>&lt;Cluster className=&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;/&gt;</source>
    to your <code>&lt;Engine&gt;</code> or your <code>&lt;Host&gt;</code> element to enable clustering.
  </p>
  <p>
    Using the above configuration will enable all to all session replication
    using the <code>DeltaManager</code> to replicate session deltas.<br/>
    Here are some of the important default values:<br/>
    1. Multicast address is 172.16.58.3<br/>
    2. Multicast port is 45564<br/>
    3. The IP broadcasted is <code>java.net.InetAddress.getLocalHost().getHostAddress()</code><br/>
    4. The TCP port listening for replication messages is the first available server socket in range <code>4000-4100</code><br/>
    5. Two listeners are configured <code>ClusterSessionListener</code> and <code>JvmRouteSessionIDBinderListener</code><br/>
    6. Two interceptors are configured <code>TcpFailureDetector</code> and <code>MessageDispatch15Interceptor</code><br/>
    The following is the default cluster configuration:<br/>
    <source>
        &lt;Cluster className=&quot;org.apache.catalina.ha.tcp.SimpleTcpCluster&quot;
                 channelSendOptions=&quot;8&quot;&gt;

          &lt;Manager className=&quot;org.apache.catalina.ha.session.DeltaManager&quot;
                   expireSessionsOnShutdown=&quot;false&quot;
                   notifyListenersOnReplication=&quot;true&quot;/&gt;

          &lt;Channel className=&quot;org.apache.catalina.tribes.group.GroupChannel&quot;&gt;
            &lt;Membership className=&quot;org.apache.catalina.tribes.membership.McastService&quot;
                        address=&quot;172.16.58.3&quot;
                        port=&quot;45564&quot;
                        frequency=&quot;500&quot;
                        dropTime=&quot;3000&quot;/&gt;
            &lt;Receiver className=&quot;org.apache.catalina.tribes.transport.nio.NioReceiver&quot;
                      address=&quot;auto&quot;
                      port=&quot;4000&quot;
                      autoBind=&quot;100&quot;
                      selectorTimeout=&quot;5000&quot;
                      maxThreads=&quot;6&quot;/&gt;

            &lt;Sender className=&quot;org.apache.catalina.tribes.transport.ReplicationTransmitter&quot;&gt;
              &lt;Transport className=&quot;org.apache.catalina.tribes.transport.nio.PooledParallelSender&quot;/&gt;
            &lt;/Sender&gt;
            &lt;Interceptor className=&quot;org.apache.catalina.tribes.group.interceptors.TcpFailureDetector&quot;/&gt;
            &lt;Interceptor className=&quot;org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor&quot;/&gt;
          &lt;/Channel&gt;

          &lt;Valve className=&quot;org.apache.catalina.ha.tcp.ReplicationValve&quot;
                 filter=&quot;&quot;/&gt;

          &lt;Deployer className=&quot;org.apache.catalina.ha.deploy.FarmWarDeployer&quot;
                    tempDir=&quot;/tmp/war-temp/&quot;
                    deployDir=&quot;/tmp/war-deploy/&quot;
                    watchDir=&quot;/tmp/war-listen/&quot;
                    watchEnabled=&quot;false&quot;/&gt;

          &lt;ClusterListener className=&quot;org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener&quot;/&gt;
          &lt;ClusterListener className=&quot;org.apache.catalina.ha.session.ClusterSessionListener&quot;/&gt;
        &lt;/Cluster&gt;    
    </source>
  </p>
</section>

<section name="Cluster Basics">

<p>To run session replication in your Tomcat 6.0 container, the following steps
should be completed:</p>
<ul>
<li>All your session attributes must implement <code>java.io.Serializable</code></li>
<li>Uncomment the <code>Cluster</code> element in server.xml</li>
<li>Uncomment the <code>Valve(ReplicationValve)</code> element in server.xml</li>
<li>If your Tomcat instances are running on the same machine, make sure the <code>tcpListenPort</code>
    attribute is unique for each instance.</li>
<li>Make sure your <code>web.xml</code> has the <code>&lt;distributable/&gt;</code> element 
    or set at your <code>&lt;Context distributable="true" /&gt;</code></li>
<li>If you are using mod_jk, make sure that jvmRoute attribute is set at your Engine <code>&lt;Engine name="Catalina" jvmRoute="node01" &gt;</code>
    and that the jvmRoute attribute value matches your worker name in workers.properties</li>
<li>Make sure that all nodes have the same time and sync with NTP service!</li>
<li>Make sure that your loadbalancer is configured for sticky session mode.</li>
{'fraction_non_alphanumeric': 0.13593073593073593, 'fraction_numerical': 0.01317941317941318, 'mean_word_length': 3.3883495145631066, 'pattern_counts': {'":': 0, '<': 201, '<?xml version=': 2, '>': 201, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3721341', 'n_tokens_mistral': 3312, 'n_tokens_neox': 3018, 'n_words': 653}