Redis session manager is pluggable one. It uses to store sessions into Redis for easy distribution of HTTP Requests across 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) method stores the session into Redis (session attribute values must be Serializable) immediately and the session getAttribute(name) method request directly from Redis. Also, the inactive sessions has been removed based on the session time-out configuration.
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
Move the downloaded jars to tomcat/lib directory
Add tomcat system property "catalina.base"
JAVA_OPTS='-Dcatalina.base=/opt/tomcat'
Extract downloaded package (tomcat-cluster-redis-session-manager.zip) to configure Redis credentials in redis-data-cache.properties file and move the file to tomcat/conf directory
Add the below two lines in tomcat/conf/context.xml
Verify the session expiration time in tomcat/conf/web.xml
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,
|
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。