tomcat使用redis共享session并实现单点登录
2016-04-12 11:05
567 查看
下载依赖
tomcat-redis-manager https://github.com/jcoleman/tomcat-redis-session-manager/downloads
commons-pool http://commons.apache.org/proper/commons-pool/download_pool.cgi
jedis http://mvnrepository.com/artifact/redis.clients/jedis
将这几个jar包放入所有tomcat的lib中
下载并安装redis
windows https://github.com/MSOpenTech/redis/releases
linux http://download.redis.io/releases/
具体安装和配置方法见百度
修改每个tomcat的context.xml文件
配置完毕,启动tomcat
注意:要放入session中的类要实现序列化接口,序列号相同
tomcat-redis-manager https://github.com/jcoleman/tomcat-redis-session-manager/downloads
commons-pool http://commons.apache.org/proper/commons-pool/download_pool.cgi
jedis http://mvnrepository.com/artifact/redis.clients/jedis
将这几个jar包放入所有tomcat的lib中
下载并安装redis
windows https://github.com/MSOpenTech/redis/releases
linux http://download.redis.io/releases/
具体安装和配置方法见百度
修改每个tomcat的context.xml文件
<Context sessionCookiePath="/"><!-- sessionCookiePath设置session cookie的域为根域名 --> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" /> <Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager" host="localhost" port="6379" database="0" maxInactiveInterval="60" password="这里写redis的密码(如果有)"/> </Context>
配置完毕,启动tomcat
注意:要放入session中的类要实现序列化接口,序列号相同
相关文章推荐
- 【高并发简单解决方案】redis缓存队列+mysql 批量入库+php离线整合
- 基于zookeeper的redis高可用
- Redis内存使用优化与存储
- CentOS7配置redis开机启动
- CentOS7安装配置redis-3.0.0
- CentOS7安装redis数据库及php-redis扩展
- Spring 整合 Redis
- Redis笔记
- Redis命令-有序集合-zrange
- Redis
- Jedis对redis的操作详解
- Jedis对redis的操作详解
- Redis-3.0.7_ubuntu下编译
- 干货--Redis+Spring+Struts2实现网站计算器应用项目案例
- Spring Boot使用redis做数据缓存
- Spring Boot使用redis做数据缓存
- Spring Boot使用redis做数据缓存
- Linux服务器如何自定义安装Redis
- Redis PHP通用类
- 分布式缓存Redis使用心得