From c64e66a15a6136547379bfe6ef4037f69caa8634 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Wed, 26 Dec 2018 13:31:49 +0300 Subject: [PATCH 1/2] Update README.md --- redisson-tomcat/README.md | 58 +++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/redisson-tomcat/README.md b/redisson-tomcat/README.md index 11332dded..f88079a45 100644 --- a/redisson-tomcat/README.md +++ b/redisson-tomcat/README.md @@ -15,15 +15,17 @@ Current implementation differs from any other Redis based Tomcat Session Manager Usage === -**1** Add `RedissonSessionManager` into `tomcat/conf/context.xml` +### 1. Add `RedissonSessionManager` + +Add `RedissonSessionManager` into `tomcat/conf/context.xml` ```xml + configPath="${catalina.base}/redisson.conf" readMode="REDIS" updateMode="DEFAULT"/> ``` `readMode` - read attributes mode. Two modes are available: - * `MEMORY` - stores attributes into local Tomcat Session and Redis. Further Session updates propagated to local Tomcat Session using Redis-based events. Default mode. - * `REDIS` - stores attributes into Redis only. + * `MEMORY` - stores attributes into local Tomcat Session and Redis. Further Session updates propagated to local Tomcat Session using Redis-based events. + * `REDIS` - stores attributes into Redis only. Default mode.
`updateMode` - attributes update mode. Two modes are available: @@ -31,31 +33,33 @@ Usage * `AFTER_REQUEST` - all session attributes are stored into Redis after each request.
- `sharedSession` - share session across multiple deployed applications. Appropriate solution for migration of EAR based application with multiple WARs hosted previously on JBoss, WebLogic... Works only in `readMode=REDIS`. - This option available only in [Redisson PRO](http://redisson.pro) edition. - - * `false` - don't share single session. Default mode. - * `true` - share single session. - - Requires to set `crossContext` setting in `tomcat/conf/context.xml` - ```xml - - ... - - ``` - Cookie path should be the same for all applications and defined in `web.xml` - ```xml - - - / - - ... - - ``` -
- `configPath` - path to Redisson JSON or YAML config. See [configuration wiki page](https://github.com/redisson/redisson/wiki/2.-Configuration) for more details. +Each RedissonSessionManager created per Web Application and thus creates own Redisson instance. For multiple applications, using the same Redis setup, amount of Redisson instances could be reduced using JNDI registry: + +1. Add shared redisson instance produced by `JndiRedissonFactory` into `tomcat/conf/server.xml` in `GlobalNamingResources` tag area: + +```xml + + + +``` + +2. Add `JndiRedissonSessionManager` with resource link to redisson instance into `tomcat/conf/context.xml` + +```xml + + + +``` + +3. Package all classes used in session into separate jar and copy it to `tomcat/lib` directory. **2** Copy two jars into `TOMCAT_BASE/lib` directory: From da3e103d4ac4646da6deefb8242ffd3e96f0a3f1 Mon Sep 17 00:00:00 2001 From: Nikita Koksharov Date: Wed, 26 Dec 2018 13:32:26 +0300 Subject: [PATCH 2/2] Update README.md --- redisson-tomcat/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/redisson-tomcat/README.md b/redisson-tomcat/README.md index f88079a45..f0ce4733b 100644 --- a/redisson-tomcat/README.md +++ b/redisson-tomcat/README.md @@ -35,6 +35,8 @@ Add `RedissonSessionManager` into `tomcat/conf/context.xml` `configPath` - path to Redisson JSON or YAML config. See [configuration wiki page](https://github.com/redisson/redisson/wiki/2.-Configuration) for more details. +#### Shared Redisson instance + Each RedissonSessionManager created per Web Application and thus creates own Redisson instance. For multiple applications, using the same Redis setup, amount of Redisson instances could be reduced using JNDI registry: 1. Add shared redisson instance produced by `JndiRedissonFactory` into `tomcat/conf/server.xml` in `GlobalNamingResources` tag area: