tomcat8.5配置redis实现session共享(tomcat-redis-session-manager-master)

亢正德
2023-12-01

本文记录nginx+redis+tomcat实现session共享的过程

nginx安装:http://blog.csdn.net/grhlove123/article/details/47834673

redis安装:http://blog.csdn.net/grhlove123/article/details/47783471

准备两个tomcat,修改相应的端口

名称

IP

端口

tomcat版本

JDK

tomcat1

10.4.247.100

81

8.5.41

1.8.0_171

tomcat2

10.4.247.100

82

8.5.41

1.8.0_171

tomcat配置

下载:https://download.csdn.net/download/u010438469/11522929

拷贝附件3个jar包到$TOMCAT_HOME/lib中

修改两tomcat的context.xml:

新增内容如下
    <Valve className="com.naritech.nicole.gump.RedisSessionHandlerValve" />  

    <Manager className="com.naritech.nicole.gump.RedisSessionManager"  

             host="127.0.0.1"  

             port="6379"  

             database="0"  

             password="password"

             />

1、nginx
启动:/usr/local/nginx/sbin/nginx
停止/重新加载:/usr/local/nginx/sbin/nginx -s stop(quit、reload)

2、redis
启动redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

3、tomcat
cd /usr/local/webServer/tomcat1/bin
cd /usr/local/webServer/tomcat2/bin
启动:./catalina.sh run 或者 ./startup.sh
停止:./shutdown.sh

参考文档:https://mp.csdn.net/postedit/51087222

 

 

 类似资料: