Databases 5 min read

Deploying Redis Sentinel for High Availability in a Master‑Slave Setup

This guide details how to set up Redis Sentinel for high‑availability in a master‑slave architecture, covering configuration file creation, essential sentinel parameters, starting Redis and Sentinel instances, and verifying operation via log inspection.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Deploying Redis Sentinel for High Availability in a Master‑Slave Setup

This article explains how to deploy Redis Sentinel to provide high availability for a Redis cluster consisting of one master and two slave nodes.

Prerequisite IP addresses:

master: 192.168.20.24

slave1: 192.168.20.25

slave2: 192.168.20.8

On each node, create /usr/local/redis/conf/sentinel.conf with the following content:

bind 0.0.0.0
port 26379
daemonize yes
logfile "/usr/local/redis/log/sentinel.log"
pidfile /var/run/sentinel.pid
sentinel monitor mymaster 192.168.20.24 6379 2
sentinel auth-pass mymaster 123456
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 180000

Start the three Redis server instances first, for example:

/usr/local/redis/bin/redis-cli -h 192.168.20.8 -p 6379 -a 123456

Then launch the three Sentinel instances. Two common ways are:

/usr/local/redis/bin/redis-server /usr/local/redis/conf/sentinel.conf --sentinel

or

/usr/local/redis/bin/redis-sentinel /usr/local/redis/conf/sentinel.conf

After the services are up, monitor the Sentinel log to confirm proper operation: tail -fn 1000 /usr/local/redis/log/sentinel.log Typical log output includes messages such as:

8181:X 17 Jun 2022 14:22:12.734 # Redis is starting
8181:X 17 Jun 2022 14:22:12.734 # Redis version=6.2.4, bits=64, commit=00000000, modified=0, pid=8181, just started
8181:X 17 Jun 2022 14:22:12.734 # Configuration loaded
8181:X 17 Jun 2022 14:22:12.735 * monotonic clock: POSIX clock_gettime
8181:X 17 Jun 2022 14:22:12.736 * Running mode=sentinel, port=26379.
8181:X 17 Jun 2022 14:22:12.737 # Sentinel ID is 988662ff1703bd362453265278cabf459dddd051
8181:X 17 Jun 2022 14:22:12.737 # +monitor master mymaster 192.168.20.24 6379 quorum 2
8181:X 17 Jun 2022 14:22:12.738 * +slave slave 192.168.20.25:6379 192.168.20.25 6379 @ mymaster 192.168.20.24 6379
8181:X 17 Jun 2022 14:22:12.739 * +slave slave 192.168.20.8:6379 192.168.20.8 6379 @ mymaster 192.168.20.24 6379
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

databasehigh availabilityredisConfigurationLinuxsentinel
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.