Starting with version 1.9.0, apollo-portal adds session sharing support so that session sharing can be implemented in cluster deployments of apollo-portal.
The default configuration is JDBC-based session sharing.
So clear the session sharing related configuration and configure the database connection, the configuration to be cleared is as follows
spring.session.store-type
configuration in the external configuration file (properties/yml)
Environment variables inside the SPRING_SESSION_STORE_TYPE
System Property inside spring.session.store-type
There are several ways to set the database connection, from highest to lowest priority, as follows
-Dspring.datasource.url=xxx
-Dspring.datasource.username=xxx
-Dspring.datasource.password=xxx
export SPRING_DATASOURCE_URL="xxx"
export SPRING_DATASOURCE_USERNAME="xxx"
export SPRING_DATASOURCE_PASSWORD="xxx"
For example config/application-github.properties
spring.datasource.url=xxx
spring.datasource.username=xxx
spring.datasource.password=xxx
If you need to use other databases, you can refer to the other table creation sql provided by spring-session
Please select the corresponding sql script according to the database you are using
There are several ways to set this up, from highest to lowest priority, as follows
Note: redis also supports cluster and sentry mode, configured in the standard Spring Data Redis
mode (configuration items starting with spring.redis
), please study the Spring Data Redis
related documentation or consult the Spring Data
Group for details
-Dspring.session.store-type=redis
-Dspring.redis.host=xxx
-Dspring.redis.port=xxx
-Dspring.redis.username=xxx
-Dspring.redis.password=xxx
export SPRING_SESSION_STORE_TYPE="redis"
export SPRING_REDIS_HOST="xxx"
export SPRING_REDIS_PORT="xxx"
export SPRING_REDIS_USERNAME="xxx"
export SPRING_REDIS_PASSWORD="xxx"
For example `config/application-github.properties
''
spring.session.store-type=redis
spring.redis.host=xxx
spring.redis.port=xxx
spring.redis.username=xxx
spring.redis.password=xxx
There are several ways to set this, in descending order of priority, as follows
-Dspring.session.store-type=none
export SPRING_SESSION_STORE_TYPE="none"
For example config/application-github.properties
spring.session.store-type=none