省略步骤:
1:安装Redis;
2:配置ngxin反向代理;
3:JDK安装;
3:tomcat安装; SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
步骤:SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
1:下载软件:tomcat-redis-session-manager-master以及需要的web测试包(非必须);
2:将下载软件lib目录下的jar放到tomcat的lib目录下;
3:修改tomcat配置目录下的content.xml SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
0 1 2 3 4 5 6 7 8 9 10 |
[root@bk ROOT]# tail /usr/local/tomcat/conf/context.xml --> <Valve className="com.naritech.nicole.gump.RedisSessionHandlerValve" /> <Manager className="com.naritech.nicole.gump.RedisSessionManager" host="192.168.2.100" password="123456" port="6379" database="4" maxInactiveInterval="6" /> </Context> |
验证:SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
0 1 2 3 4 5 6 7 |
[root@bk ~]# /usr/local/redis/bin/redis-cli -h 192.168.2.100 -a 123456 192.168.2.100:6379> select 4 OK 192.168.2.100:6379[4]> keys * 1) "847B944F871229C94B8F4214DDE4D4AD" 192.168.2.100:6379[4]> get 847B944F871229C94B8F4214DDE4D4AD "\xac\xed\x00\x05sr\x005com.naritech.nicole.gump.SessionSerializationMetadataei\xe7\xc7\xc6\xcd7\xea\x03\x00\x01[\x00\x15sessionAttributesHasht\x00\x02[Bxpw\x14\x00\x00\x00\x10\x15\x1a\xb6\x8d_\xfb\xbe\xf1wr.v]v\x87\x8dxsr\x00\x0ejava.lang.Long;\x8b\xe4\x90\xcc\x8f#\xdf\x02\x00\x01J\x00\x05valuexr\x00\x10java.lang.Number\x86\xac\x95\x1d\x0b\x94\xe0\x8b\x02\x00\x00xp\x00\x00\x01\\\x19&-\xb1sq\x00~\x00\x03\x00\x00\x01\\\x19&-\xb1sr\x00\x11java.lang.Integer\x12\xe2\xa0\xa4\xf7\x81\x878\x02\x00\x01I\x00\x05valuexq\x00~\x00\x04\x00\x00\a\bsr\x00\x11java.lang.Boolean\xcd r\x80\xd5\x9c\xfa\xee\x02\x00\x01Z\x00\x05valuexp\x00sq\x00~\x00\t\x01sq\x00~\x00\x03\x00\x00\x01\\\x19&Z\xbat\x00 847B944F871229C94B8F4214DDE4D4ADsq\x00~\x00\a\x00\x00\x00\x02t\x00\x04USERsr\x00\x16com.xuliugen.bean.User5T\xf0\xd2\xe1\x87\x9d\x7f\x02\x00\x02L\x00\buserNamet\x00\x12Ljava/lang/String;L\x00\x0cuserPasswordq\x00~\x00\x11xpt\x00\x0512345t\x00\x0511111t\x00\x04clj1t\x00\x0bclj20150527w\b\x00\x00\x01\\\x19&-\xb1" 192.168.2.126:6379[4]> |
软件下载:SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
jar包:http://pan.baidu.com/s/1o8RX9gA 密码:xbg5
测试web包:http://pan.baidu.com/s/1boX35uR 密码:br07SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
参考文档:
1:https://github.com/jcoleman/tomcat-redis-session-manager
2:http://www.cnblogs.com/interdrp/p/4868740.html
3:http://blog.csdn.net/eguid_1/article/details/52637969
4:https://github.com/ran-jit/TomcatClusterRedisSessionManager
5:http://www.cnblogs.com/nick-huang/p/5774711.htmlSourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/
SourceByrd's Weblog-https://note.t4x.org/environment/nginx-tomcat-redis-session/