問題
camunda cockpit通過session來管理登陸信息,假如部署多實例的話,會遇到查不到session的問題,導致用户無法登陸
解決辦法
通過redis來存儲和管理session
引入spring-boot-starter-data-redis和spring-session-data-redis
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
在服務啓動類上加上註解 @EnableRedisHttpSession()
配置spring.redis (springboot 2.x版本)或者spring.data.redis(springboot 3.x版本)
spring.redis:
host: ${REDIS_URL}
port: 6379
password: ${REDIS_PASSWORD}
username: ${REDIS_USERNAME}
# 連接池優化
lettuce:
pool:
max-active: 50
min-idle: 5
這樣就開啓了redis來管理session了,camunda cockpit就可以在集羣模式下使用了。
參考
https://docs.camunda.org/manual/latest/introduction/architect...