Redisson Tomcat Session Replication unique JSESSIONID

8/5/2021

I am using redisson to replicate tomcat sessions of my spring application across 3 tomcat pods running tomcat v8.5. I have also deployed Redis in the same Kubernetes cluster. Here is my tomcat context.xml config

<Manager className="org.redisson.tomcat.RedissonSessionManager" configPath="${catalina.base}/conf/redisson.yaml" readMode="REDIS" updateMode="DEFAULT" />

My redisson config is as follows:

masterSlaveServersConfig:
  password: 'password'
  readMode: "MASTER_SLAVE"
  subscriptionMode: "SLAVE"
  slaveAddresses:
  - "redis://redis-replicas:6379"
  masterAddress: "redis://redis-master:6379"

When i run my application and load balance requests across all pods it creates a new JSESSIONID cookie for each request sent to different pod

This should validate JSESSIONID created on pod 1 on pod2 without creating a new one Can anyone tell me what configuration make sure that JSESSIONID remain same across all pods for a single session ?

-- Hassnain Alvi
kubernetes
redis
redis-cluster
redisson
tomcat

1 Answer

10/11/2021

You need to set broadcastSessionEvents = true setting for RedissonSessionManager.

-- Nikita Koksharov
Source: StackOverflow