tomcat8 redis session共享

Preface

Tomcat clustering with Redis data-cache implementation.

Redis session manager is plugjava面试题-gable one. It uses to store sessions ilinux系统n色多多绿巨人黑科技下载安装to Redis for ealinux系统安装sy distribution of HTTP Requests acredis持久化ross a cluster of Tomcat servers. Sessions are implemented as-as non-sticky i.e, each request is forwarded to any server in round-robin manner.

The HTTP Requests session setAttribute(name系统运维工程师, value) methodtomcat启动一闪就没 stores the session into Red系统运维工程师is (must be Serializable) immediately and the session ge系统运维工作内容tAttribulinux创建文件te(name) method request directly系统运维工程师 from Redis. Also, the inactive sessions have been removed based色多多绿巨人黑科技下载安装 on the sessiredison time-out configutomcat的catalina太大ration.

It supports, both Redis stand-alone and multiple node clusters bredis集群ased on the redis-data-cache.properties色多多下载 configuration.

Step to be done

1.Move the download jars to tomcat/lib directory

download jajava编译器rs:

http://download.csdn.net/download/kwy15732621629/10203812 or leave your email ?

2.to add a file namedredis-data-cache.properties and move the file to tomcat/conf directory

#-- Redis data-cache configuration
#- redis hosts ex: 127.0.0.1:6379, 127.0.0.2:6379, 127.0.0.2:6380, ....
redis.hosts=127.0.0.1:6379
#- redis password (for stand-alone mode)
#redis.password=
#- set true to enable redis cluster mode
redis.cluster.enabled=true
#- redis database (default 0)
#redis.database=0
#- redis connection timeout (default 2000)
#redis.timeout=2000

3.Add the below two lines in tomcat/conf/context.xml

<Valve className="tomcat.request.session.redis.SessionHandlerValve" />
<Manager className="tomcat.request.session.redis.SessionManager" />

4.Verify the session expiration time (minutes) in tomcat/conf/web.xml

<session-config>
<session-timeout>60</session-timeout>
</session-config>

OKtomcat闪退, that's allredis数据