ELMA365 On-Premises > Other > ELMA365 high availability cluster / Redis cluster

Redis cluster

Servers are combined into a Primary/Replica(s) cluster. One server acts as the main one and sends its data to the others. Read more about setting up and working with a PostgreSQL cluster in the official documentation: https://redis.io/topics/sentinel.

Instructions on installing and configuring Redis can be found on the official website: https://redis.io/download. The guide to Sentinel can be found in the documentation: https://redis.io/docs/management/sentinel/.

Basic information

начало внимание

You need at least 3 servers to create a Redis cluster.

конец внимание

In this example, 3 nodes with the following hostnames and IP addresses are used:

  • redis-server1,
  • redis-server2,
  • redis-server3,

Step 1: Install Redis

  1. Add the Redis repositories:

sudo add-apt-repository ppa:redislabs/redis

  1. Install Redis and its dependencies:

sudo apt-get -y install redis redis-sentinel net-tools

Step 2: Configure Redis

To configure Redis, edit the /etc/redis/redis.conf file on each server:

sudo nano /etc/redis/redis.conf

  1. Make the servers available for all IP addresses of the server:


In our case, the Redis service becomes available from all external addresses.

  1. Increase the maximum number of clients by changing the maxclients parameter to 20000. You also need to uncomment the line (delete the # character):

maxclients 20000

  1. Set the Redis password:

requirepass SecretPassword

  1. Specify a password for the primary node:

masterauth SecretPassword

  1. To configure a subordinate node, you need to specify the primary’s address and port:

replicaof redis-server1.your_domain 6379

  1. Restart all servers (first the primary, then the subordinates):

sudo systemctl restart redis-server
sudo systemctl enable redis-server

  1. Check the replication status:

sudo redis-cli -a SecretPassword info replication

Step 3: Configure Sentinel

To configure Sentinel, edit the /etc/redis/sentinel.conf file on each server.

начало внимание

For correct operation, don’t change the specified order of lines in the /etc/redis/sentinel.conf file.

конец внимание

  1. Make the servers available to all IP addresses of this server:


In our case, this makes the Sentinel service available from all external addresses.

  1. Specify the primary’s address and port and set the quorum.

sentinel monitor mymaster 6379 2

  1. Set a password that will be used to access the primary:

sentinel auth-pass mymaster SecretPassword

  1. Set the timeout for considering the primary node inactive:

sentinel down-after-milliseconds mymaster 3000

  1. Set the timeout for changing a subordinate node’s role to primary if the primary node doesn’t respond:

sentinel failover-timeout mymaster 6000

  1. Restart all servers:

sudo systemctl restart redis-sentinel
sudo systemctl enable redis-sentinel

  1. Check the Sentinel’s status and check whether the quorum configuration is correct:

sudo redis-cli -p 26379 info sentinel
sudo redis-cli -p 26379 sentinel ckquorum mymaster

Step 4: Connect to ELMA365

To connect to the Redis cluster, run the following:


Found a typo? Highlight the text, press ctrl + enter and notify us