Reputation: 1001
I have a Spring Cloud based application with multiple backend Spring-Boot servers. The servers are all sharing their session with a single Redis server via @EnableRedisHttpSession.
I now have a requirement for failover support of Redis in production, which means I will have to setup a master-slave configuration (I guess...).
How will I configure Http Session replication via Redis to be aware of the two servers? I could not find any documentation on this. Note that I am not using Spring Data Redis here, just the Spring Session support for Redis.
Upvotes: 1
Views: 1957
Reputation: 18119
Spring Session Redis uses Spring Data Redis to integrate with Redis and so you can use Redis Sentinel (see http://redis.io/topics/sentinel). To give you the full picture:
Redis allows managed (Redis Sentinel) and unmanaged Master-Slave setups. Unmanaged setups provide no failover whereas Sentinel managed setups failover the master node once it's down. Redis Sentinel monitors all master/slave nodes and once a master is not available, a slave will be promoted to a new master.
You can configure Spring Data Redis for Sentinel usage with following properties:
spring.redis.sentinel.master
: name of the master node.spring.redis.sentinel.nodes
: Comma delimited list of host:port pairs.or you provide an own RedisConnectionFactory
bean. See Spring Data Redis docs for further details.
HTH, Mark
Upvotes: 3