jk 负载均衡+集群+session 复制(3)

 

 

首页服务器应用

背景:

阅读新闻

Linux下apache tomcat mod_jk 负载均衡+集群+session 复制

[日期:2011-03-02]   来源:Linux社区  作者:ppzlyg   [字体:]  

12.修改tomcat2的server.xml文件

<Engine defaultHost="localhost" jvmRoute="worker2">

<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="192.168.15.124"
                      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"/>
          </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>

13.查看

netstat –ant

tcp        0      0 ::ffff:192.168.15.124:4000  :::*                        LISTEN     
tcp        0      0 ::ffff:192.168.15.124:4001  :::*                        LISTEN     

14.修改应用程序的web.xml文件

在</web-app> 之前加上<distributable/> 用于session 复制

vi /usr/local/tomcat2/webapps/examples/WEB-INF/web.xml

vi /usr/local/tomcat2/webapps/examples/WEB-INF/web.xml

vi /usr/local/apache2/htdocs/examples/WEB-INF/web.xml

<distributable/>
</web-app>

15.测试session 复制

打开

输入相关内容,然后关闭其中的正在连接的tomcat 连接到第二个tomcat 查看之前提交的内容是否还在

Sessions Example
Session ID: A45E7C637D98B3EBDEF052BEADF8E5F4.worker2
Created: Mon Jan 31 12:07:33 CST 2011
Last Accessed: Mon Jan 31 12:09:26 CST 2011
The following data is in your session:
1 = 1
2 = 2

Sessions Example
Session ID: A45E7C637D98B3EBDEF052BEADF8E5F4.worker1
Created: Mon Jan 31 12:07:33 CST 2011
Last Accessed: Mon Jan 31 12:10:09 CST 2011
The following data is in your session:
1 = 1
2 = 2

linux

 

简单LNMP安装脚本

Linux下apache tomcat ajp_proxy 负载均衡+集群+session 复制

相关资讯       Linux集群 

   

本文评论   查看全部评论 (0)


评论声明

尊重网上道德,遵守中华人民共和国的各项有关法律法规

承担一切因您的行为而直接或间接导致的民事或刑事法律责任

本站管理人员有权保留或删除其管辖留言中的任意内容

本站有权在网站内转载或引用您的评论

参与本评论即表明您已经阅读并接受上述条款

 

 

 

最新资讯

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyzdys.html