tomcat6叢集session共用配置的實現

來源:互聯網
上載者:User

要實現多個tomcat的叢集,需要在server.xml配置中,Engine節點加入Cluster的配置,從官方 http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html 文檔上看是這樣的:

        <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>  

當tomcat啟動的時候會報一個 "嚴重:.....deployer......" 的錯,但不影響應用。如果你看著不爽可以把以上<Deployer>節點去掉。

然後在應用的web.xml裡,加上<distributable/>  以說明該應用是要進行分布式部署的,這樣session共用才會生效,切記切記!!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.