tomcat配置集群

来源:互联网 发布:utorrent mac 中文版 编辑:程序博客网 时间:2024/06/07 09:41

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

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

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

<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>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

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


原创粉丝点击