session共享

Nginx或者Squit反向代理到两台tomcat服务器

tomcat使用memcached

tomcat连接memcached工具

cp session/*.jar /usr/local/tomcat/lib/

session

172.30.13.100与172.30.13.200提供memcached服务

cd /usr/local/tomcat/conf/
vim context.xml <Context>
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="memA:172.30.13.100:11211,memB:172.30.13.200:11211" failoverNodes="memB" REQUESTuRILGNOREpATTERN=".*\(ico|png|gif|jpg|css|js\)$" transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" /> </Context> /usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh

测试文件

cat /usr/local/tomcat/webapps/ROOT/test.jsp
<html>
<body bgcolor="green">
<center>
<%= request.getSession().getId() %>
<h1>xzdz-lk</h1>
</center>
</body>
</html>
上一篇:JavaScript 自定义文本框光标——初级版


下一篇:Xamarin Android自定义文本框