Tomcat 7 redis cluster session manager

Tomcat 7 redis cluster session manager
pull/1/merge
Ranjith 2016-03-19 21:03:09 +05:30
parent cee0ead739
commit 5683e79295
1 changed files with 27 additions and 29 deletions

View File

@ -7,40 +7,38 @@
* @since 1.0 * @since 1.0
*/ */
Pre-requisite: Supports:
-------------- * Apache Tomcat 7
1. jedis-2.8.0.jar (Available in - http://central.maven.org/maven2/redis/clients/jedis/2.8.0/jedis-2.8.0.jar)
2. commons-pool2-2.2.jar (Available in - http://central.maven.org/maven2/org/apache/commons/commons-pool2/2.2/commons-pool2-2.2.jar) Downloads:
3. commons-logging-1.1.jar (Available in - http://central.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar)
Note: Download all the above three jars and move it into tomcat/lib directory Pre-requisite:
1. jedis-2.8.0.jar
2. commons-pool2-2.4.2.jar
3. commons-logging-1.2.jar
Tomcat Redis Cluster Enabled Session Manager jar is available in below location
https://github.com/ran-jit/TomcatRedisClusterEnabledSessionManager/releases/download/1.0/TomcatClusterEnabledRedisSessionManager-1.0.zip
Steps to be done, Steps to be done,
----------------- 1. Move the downloaded jars to tomcat/lib directory
1. Add Tomcat system property "catalina.home" * $catalina.home/lib/
catalina.home="TOMCAT_ROOT_LOCATION"
example: c:/ranjith/apache-tomcat-8.0.32
2. Download the TomcatRedisSessionManager-1.1.jar 2. Add tomcat system property "catalina.base"
Available in - * catalina.base="TOMCAT_LOCATION"
3. Move the downloaded jar (TomcatRedisSessionManager-1.1.jar) to tomcat/lib directory 3. Extract downloaded jar (TomcatClusterEnabledRedisSessionManager-1.0.jar) to configure Redis credentials in RedisDataCache.properties file and move the file to tomcat/conf directory
$catalina.home/lib/TomcatRedisSessionManager-1.1.jar * tomcat/conf/RedisDataCache.properties
example: c:/ranjith/apache-tomcat-8.0.32/lib/TomcatRedisSessionManager-1.1.jar
4. Extract downloaded jar (TomcatRedisSessionManager-1.1.jar) to configure redis data cache credentials in "RedisDataCache.properties" file and move the file to $catalina.home/conf directory 4. Add the below two lines in tomcat/conf/context.xml
$catalina.home/conf/RedisDataCache.properties * <Valve className="com.r.tomcat.session.management.RequestSessionHandlerValve">
example: c:/ranjith/apache-tomcat-8.0.32/conf/RedisDataCache.properties * <Manager className="com.r.tomcat.session.management.RequestSessionManager">
5. Add the below two lines in $catalina.home/conf/context.xml 5. Verify the session expiration time in tomcat/conf/web.xml
<Valve className="com.r.tomcat.session.management.RequestSessionHandlerValve" /> * <session-config>
<Manager className="com.r.tomcat.session.management.RequestSessionManager" /> * <session-timeout>60<session-timeout>
* <session-config>
6. Verify the session expiration time in $catalina.home/conf/web.xml
<session-config>
<session-timeout>EXPIRATION TIME IN MINUTES</session-timeout>
</session-config>
Note: Note:
----- * The Redis session manager supports, both single redis master and redis cluster based on the redis.properties configuration.
* This clustering implementation supports, both redis single node and cluster environment based on the RedisDataCache.properties configuration.