pzmayf 发表于 2013-2-7 18:57:07

tomcat集群

1.安装apache apache_2.2.11-win32-x86-no_ssl.msi,不要安装在中文路径下

2.下载mod_jk-1.2.28-httpd-2.2.3.so,必须与apache版本一致

3.安装完apache后,把mod_jk-1.2.28-httpd-2.2.3.so放在modules下面

4.修改tomcate端口,如下
tomcat1 shutdown端口:9005监听端口:原8080-改8880   AJP 1.3端口原8009--改9009
tomcat2 shutdown端口:9006监听端口:原8080-改8881   AJP 1.3端口原8009--改9010

5.修改httpd.conf中增加一个include mod_jk-1.2.28-httpd-2.2.3.so文件名
6.新增mod_jk.conf与workers.properties文件,参考我的模版

7.TOMCAT集群代码如下,修改所有TOMCAT,Receiver这个节点的port在每个TOMCAT上都不一样
而且在每个tomcat上指定不同的jvmRoute,该名字与apache中的配制名字一样即可
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">         
    <!--
    <Engine name="Catalina" defaultHost="localhost">
-->
      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html(simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <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.BackupManager"
       expireSessionsOnShutdown="false"
       notifyListenersOnReplication="true"
       mapSendOptions="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="300"/>
      
      <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
      address="auto"
      port="4001"
      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" />
      <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor" />
      </Channel>
      <Value className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>
      <Value 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]
查看完整版本: tomcat集群