nginx配置
upstream session_server{
server 10.10.16.163:8080 weight=1 max_fails=2 fail_timeout=2;
server 10.10.16.163:8081 weight=1 max_fails=2 fail_timeout=2;
#keepalive 2000;
}
location /testSession/ {
proxy_pass http://session_server;
}
tomcat配置
context.xml
lib/
tomcat-redis-session-manager-VERSION.jar
jedis-2.5.2.jar
commons-pool2-2.2.jar
启动redis
启动tomcat
启动nginx
使用的开源软件
https://github.com/jcoleman/tomcat-redis-session-manager
打包方法,安装gradle, 配置path, 然后执行 gradle build
最后访问 http://127.0.0.1/testSession
注意不要用http://localhost访问