帮助文档
https://github.com/magro/memcached-session-manager/wiki/SetupAndConfiguration
安装步骤
- Node 1 和 Node 2 操作一致
- 相关 jar 包
1.memcached-session-manager
2.memcached-session-manager-VERSION # 选择对应 Tomcat 版本
3.kryo 相关 jar 包 # 序列化相关
4.jedis
~]# yum install -y tomcat redis
~]# vim /etc/redis.conf
bind 0.0.0.0
~]# systemctl start redis
~]# redis-cli
slaveof 172.18.33.101 # 配置 Redis 主从
~]# cd /root/msm
~]# cp * /usr/share/java/tomcat
~]# vim /etc/tomcat/server.xml
<Context path="/myapp" docBase="/data/webapps/myapp" reloadable=""> // Context 配置段需放置于 Host 段内
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="redis://172.18.33.101" // 名称:主机名|IP 地址:端口
sticky="false"
sessionBackupAsync="uriPattern:/path1|/path2"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" // 不匹配资源
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
/>
</Context>
~]# systemctl start tomcat