Configure Redis

The Token Server engine uses Redis as a cache server to store short-lived values in memory. This speeds up the application and reduces the number of database queries significantly.

Sentinel is an application that provides high-availability for Redis. The rest of this chapter describes how Redis including Sentinel can be setup and how to configure Redis in the Token Server engine.

Example Redis Compose configuration

In order to have a high-available Redis setup you must deploy at least 3 Sentinels and 2 Redis nodes (one slave and one master). You need 3 Sentinels because in case of a failure of the Redis master the Sentinels need to elect a new master. If there are only 2 Sentinels available they cannot get a majority to elect a new master and the cluster is in a masterless state which means that it will not function anymore.

Token Server Engine and Admin configuration

The Token Server Engine and Admin connect to Redis through Sentinel. This means that the Sentinel nodes must be configured in the Token Server Engine and Admin.
Add the following properties to the container environment configuration. The values are inspired on the Redis configuration shown above.

The TOKEN_SERVER_REDIS_SENTINEL_NODES are a comma separated list of host:port pairs that define all sentinel nodes. The TOKEN_SERVER_REDIS_SENTINEL_MASTER_ID defines the name of the Redis master. The Onegini Redis container creates a Redis master that is called mymaster so we need to tell the Token Server that our master is called mymaster.