Tomcat共享Session并且通过Memcached集中管理 memcachedtomcat
程序员文章站
2024-03-18 17:50:10
...
【multi-war share the same session OK】=>loadbalacne的前提是每个节点是对等的
/////////////begin/////////
>>>${Tomcat_home}/conf/context.xml =><Context ... sessionCookiePath="/">
>>>${Tomcat_home}/conf/server.xml=>session need to be managed by memcached
*************begin************
<Context path="/bb" docBase="E:\work\apache-tomcat-7.0.59\webcode\bb" reloadable="false" crossContext="true">
<!-- using kryo serializer || sessionBackupTimeout unit is minute -->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.1.190:11211,n2:192.168.1.209:11311"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico|jpeg|htm|html)$"
sessionBackupAsync="true"
sessionBackupTimeout="60"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
sticky="false"
copyCollectionsForSerialization="true" />
</Context>
*************end**************
***********begin************
<Context path="/ee" docBase="E:\work\apache-tomcat-7.0.59\webcode\ee" reloadable="false" crossContext="true">
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.1.190:11211,n2:192.168.1.209:11311"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico|jpeg|htm|html)$"
sessionBackupAsync="true"
sessionBackupTimeout="60"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
sticky="false"
copyCollectionsForSerialization="true" />
</Context>
***********end**************
/////////////end///////////
此处/bb和/ee应用可以共享session,通过memcached对session进行集中管理。
/////////////begin/////////
>>>${Tomcat_home}/conf/context.xml =><Context ... sessionCookiePath="/">
>>>${Tomcat_home}/conf/server.xml=>session need to be managed by memcached
*************begin************
<Context path="/bb" docBase="E:\work\apache-tomcat-7.0.59\webcode\bb" reloadable="false" crossContext="true">
<!-- using kryo serializer || sessionBackupTimeout unit is minute -->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.1.190:11211,n2:192.168.1.209:11311"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico|jpeg|htm|html)$"
sessionBackupAsync="true"
sessionBackupTimeout="60"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
sticky="false"
copyCollectionsForSerialization="true" />
</Context>
*************end**************
***********begin************
<Context path="/ee" docBase="E:\work\apache-tomcat-7.0.59\webcode\ee" reloadable="false" crossContext="true">
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:192.168.1.190:11211,n2:192.168.1.209:11311"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico|jpeg|htm|html)$"
sessionBackupAsync="true"
sessionBackupTimeout="60"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
sticky="false"
copyCollectionsForSerialization="true" />
</Context>
***********end**************
/////////////end///////////
此处/bb和/ee应用可以共享session,通过memcached对session进行集中管理。
上一篇: 算法笔记问题 B: 数制转换