码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat配置集群

时间:2016-08-16 16:21:19      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

在Tomcat中使用集群功能相对简单。最简单的用法是直接在server.xml文件的或节点下添加

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>

配置,这意味着集群相关的配置都使用默认的,它其实等同于

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
          <Manager className="org.apache.catalina.ha.session.DeltaManager"
                   expireSessionsOnShutdown="false"
                   notifyListenersOnReplication="true"/>
          <Channel className="org.apache.catalina.tribes.group.GroupChannel">
            <Membership className="org.apache.catalina.tribes.membership.McastService"
                        address="228.0.0.4"
                        port="45564"
                        frequency="500"
                        dropTime="3000"/>
            <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                      address="auto"
                      port="4000"
                      autoBind="100"
                      selectorTimeout="5000"
                      maxThreads="6"/>
            <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
              <Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
            </Sender>
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
            <Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
          </Channel>
          <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                 filter=""/>
          <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
          <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
                    tempDir="/tmp/war-temp/"
                    deployDir="/tmp/war-deploy/"
                    watchDir="/tmp/war-listen/"
                    watchEnabled="false"/>
          <ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener">
          <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener">
        </Cluster>

默认情况下使用DeltaManager会话管理器;使用GroupChannel作为集群通信通道,组播地址和端口为228.0.0.4和45564,使用ReplicationTransmitter作为消息发射器,使用NioReceiver作为消息接收器,另外添加TcpFailureDetector和MessageDispatch15Interceptor两个拦截器;使用ReplicationValve和JvmRouteBinderValve管道阀门;使用FarmWarDeployer作为集群部署器;添加JvmRouteSessionIDBinderListener和ClusterSessionListener集群监听器。

tomcat配置集群

标签:

原文地址:http://blog.csdn.net/wangyangzhizhou/article/details/52220821

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!