There are several solutions for session sharing in the Tomcat cluster environment, here is a simple solution.
The session is stored using Redis, and the configuration is relatively simple. Web server is Tomcat6
1. Download the jar package:
Commons-pool-1.6.jar
Jedis-2.1.0.jar
Tomcat-redis-session-manager-tomcat6.jar
2. Modify the Content.xml configuration file in the tomcat/conf directory
Add the following content
<valve classname= "Com.radiadesign.catalina.session.RedisSessionHandlerValve"/> <manager classname= " Com.radiadesign.catalina.session.RedisSessionManager " host=" localhost " port=" 6379 " database=" 8 " maxinactiveinterval= "/>"
The TOMCAT7 configuration is the same, except that the jar package version is different.
Jar Package DOWNLOAD Link:
Http://pan.baidu.com/s/1i3H4gD3
If there is a need can go to https://github.com/jcoleman/tomcat-redis-session-manager according to the needs of their own packaging jar use.
Tomcat uses Redis storage sharing session