tomcat+redis

tomcat配置好redis后一直打不开网页 ,各种版本各种jar包更换还是不行,context.xml配上那句话tomcat重启后就无法打开网页,最后参考了一文章找到问题是:tomcat-redis-session-manager1.2.jar里面的RedisSessionHandlerValve和RedisSessionManager的路径是com/orangefunction/tomcat/  ,网上文章写的路径可能和你的jar包里的路径不一样导致出错,这里一定要把jar解压开看看路径和tomcat的context.xml里面写的是不是一样

<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"

参考1

参考2

tomcat安装配置

redis3.2.2安装

nginx安装

nginx负载均衡配置 


[root@nginx conf]# vi nginx.conf   主要修改两个地方  还有一些日志的行去掉注释,粗体的两个地方要一直

#gzip on;
upstream localhost {
server 192.168.1.5:8080 weight=1;
server 192.168.1.6:8080 weight=2;
}


location / {
root html;
index index.html index.htm;
proxy_pass http://localhost;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100m;
}

.5 .6是tomcat

.112nginx   

.7.8是redis

http://192.168.1.112/session.jsp   通过nginx负载均衡转发到tomcat后的结果sessionid一样  如果单独访问两个tomcat的话session还是不一样的

原文地址:https://www.cnblogs.com/hanxing/p/5766927.html