版本:apache-tomcat-8.0.53.zip
<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.MessageDispatch25Interceptor" />
</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.ClusterSessionListener" />
</Cluster>
session.jsp
<html>
<head>
<title>test2</title>
</head>
<body>
SessionID is
<%=session.getId()%>
<BR> SessionIP is
<%=request.getServerName()%>
<BR> SessionPort is
<%=request.getServerPort()%>
<%
out.println("Response from tomcat2");
%>
</body>
</html>
比如放置在:
/Users/da/Library/Tomcat/apache-tomcat-8.0.53-8082/webapps/ROOT/session.jsp
另一台一样。
访问:
http://localhost:8081/session.jsp
http://localhost:8082/session.jsp
sessionid一致:
SessionID is 6E5D26E07FDE6FB5D01A59F457D64333
SessionIP is tomcat.chinaunicom.tech
SessionPort is 80 Response from tomcat1
SessionID is 6E5D26E07FDE6FB5D01A59F457D64333
SessionIP is tomcat.chinaunicom.tech
SessionPort is 80 Response from tomcat2
参考官网:
http://localhost:8082/docs/cluster-howto.html
http://tomcat.apache.org/tomcat-8.0-doc/config/cluster.html
翻译:
http://wiki.jikexueyuan.com/project/tomcat/clustering.html
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
名称栏目:tomcat8的session共享实现方案-创新互联
网页路径:https://www.cdcxhl.com/article20/docjjo.html
成都网站建设公司_创新互联,为您提供企业网站制作、网站制作、网站营销、微信公众号、响应式网站、全网营销推广
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联