nginx,tomcat,redis 整合session共享

对负载均衡的tomcat 中context.xml进行redis服务的配置:
tomcat context.xml中配置 ( 配置redis服务 ) :
<?xml version='1.0' encoding='utf-8'?> <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- tomcat-redis-session共享配置 --> <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" /> <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" host="ip" port="6379" database="0" maxInactiveInterval="60" /> </Context>
 
如果Redis配置了访问权限,请添加密码为:
<?xml version='1.0' encoding='utf-8'?> <Context> <WatchedResource>WEB-INF/web.xml</WatchedResource> <!-- tomcat-redis-session共享配置 --> <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" /> <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" host="ip" port="6379" database="0" password="redispassword" maxInactiveInterval="60" /> </Context>
 
使用到的jar包:commons-pool2-2.0.jar  jedis-2.7.2.jar  tomcat-redis-session-manage-tomcat7.jar
jar包下载地址:http://download.csdn.net/detail/eflyings/9868169
将这三个jar包放入tomcat lib文件夹下;
posted @ 2017-06-12 15:48  Eflying  阅读(85)  评论(0)    收藏  举报