# Redis Integration
Redis database server can be used on Entando for cache management in high availability applications. It is a requirement for Entando Applications serving multiple tenants. This tutorial describes the steps to integrate Redis for both high availability and multitenancy.
See Entando Multitenancy for more information.
A working instance of Entando based on the default Tomcat server image
Verify dependencies with the Entando CLI:
ent check-env develop
Helm 3 installed in your local environment
# Install Redis Sentinel (opens new window)
- Clone the project:
git clone https://github.com/entando-ps/redis-sentinel.git
- The number of Redis replica is 3; it can be adjusted by modifying the
- By default, the Redis Sentinel configuration does not use a password. For an external Redis installation where a password is required, you can define a value for the parameter
values.yamlso that Helm creates a secret for it.
- Set your Kubernetes context to the proper namespace:
kubectl config set-context --current --namespace=YOUR-NAMESPACE
- Run the custom script:
# Configure the EntandoApp
- Scale down the EntandoApp deployment to 0:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=0 -n YOUR-NAMESPACE
- Edit the deployment YAML and add the environment variables listed below.
REDIS_ADDRESSES, note the Sentinel node's logs that list the domain names of the Redis cluster instances. List the master first, then the replicas as shown in this example.
- name: REDIS_ACTIVE
- name: REDIS_ADDRESSES
- name: REDIS_SESSION_ACTIVE
- Scale the deployment back up to 1 or more replicas:
kubectl scale deploy/YOUR-APP-NAME-deployment --replicas=1 -n YOUR-NAMESPACE
- To check that your Redis is running as expected, shell into the
redis-node-0pod, then execute
KEYS *to list all current keys present in the cache.
# Additional Settings
- Use a password for Redis
If a password was used in your Redis
values.yamlfile, an additional environment variable is required in the EntandoApp deployment image.
- name: REDIS_PASSWORD
- Monitor Redis
When Redis Sentinel is active, Sentinel monitoring can be utilized to trigger an automatic failover process by using an additional environment variable in the EntandoApp deployment image.
- name: REDIS_USE_SENTINEL_EVENTS
If this env variable is set to
true, the Sentinel failover process for electing a new master will be used when a master node becomes unreachable.
When the variable is set to
false, the application doesn't subscribe to the events but uses a scheduler to periodically check the master IP to detect if the master has changed. This can be useful as a fallback method in case of a problem with events detections.