memcached+Session共享
一:tomcat8配置环境
(1)tomcat的conf目录下context.xml中增加如下配置:
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="n1:10.171.169.XXX:11211" lockingMode="auto" sticky="false" requestUriIgnorePattern= ".*\.(png|gif|jpg|css|js)$" sessionBackupAsync= "false" sessionBackupTimeout= "100" transcoderFactoryClass="de.javakaffee.web.msm.serializer.javolution.JavolutionTranscoderFactory" />
(2)tomcat的lib目录下增加如下jar包
测试环境:tomcat8.5.8,两台tomcat都需要上面的两步配置。kryo序列化方法在版本较高的tomcat上报无法序列化错误,比如tomcat8.5.8,可以试下这种方法。
二:tomcat7配置环境
(1)tomcat的context.xml配置
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager" memcachedNodes="n1:10.10.195.112:11211" sticky="false" sessionBackupAsync="false" sessionBackupTimeout="3000" lockingMode="auto" requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory" />
(2)lib包
此版本的jar包和tomcat8所需的包版本不同,要求比较严格,否则可能会启动报错