The Redis session manager is pluggable one. It stores session into Redis for easy distribution of HTTP Requests across a cluster of Tomcat servers.
Here the Sessions are implemented as non-sticky (means, each request can able to go to any server in the cluster, unlike the Apache provided Tomcat clustering setup.)
Request Sessions will be stored into Redis immediately (Session attributes must be Serializable), for the use of other servers. When tomcat receives a request from the client, Sessions are loaded directly from Redis.
Supports Redis default, sentinel and cluster mode, based on the configuration.
Going forward, we no need to enable sticky session (JSESSIONID) in Load Balancer.
more details.. https://github.com/ran-jit/tomcat-cluster-redis-session-manager/wiki
Copy the downloaded jars to your tomcat/lib directory.
Add tomcat system property "catalina.base".
Copy the redis-data-cache.properties file to your tomcat/conf directory and update your Redis server details.
Add the below two lines in your tomcat/conf/context.xml file.
Verify the session expiration time in tomcat/conf/web.xml file.
Property | Description |
---|---|
redis.hosts | Redis server running instance IP address and port number - ex: 127.0.0.1:6379, 127.0.0.2:6379, 127.0.0.2:6380, .. - default: 127.0.0.1:6379 |
redis.password | Redis protected password |
redis.database | Redis database selection. (Numeric value) - default: 0 |
redis.timeout | Redis connection timeout - default: 2000 ms |
redis.cluster.enabled | To enable redis cluster mode - default: false - supported values: true/false |
redis.sentinel.enabled | To enable redis sentinel mode - default: false - supported values: true/false |
redis.sentinel.master | Redis sentinel master name - default: mymaster |
lb.sticky-session.enabled | To enable redis and standard session mode If enabled,
|
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。