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.
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.0port 26379daemonize yeslogfile "/usr/local/redis/log/sentinel.log"pidfile /var/run/sentinel.pidsentinel monitor mymaster 192.168.20.24 6379 2sentinel auth-pass mymaster 123456sentinel down-after-milliseconds mymaster 10000sentinel failover-timeout mymaster 180000Start the three Redis server instances first, for example:
/usr/local/redis/bin/redis-cli -h 192.168.20.8 -p 6379 -a 123456Then launch the three Sentinel instances. Two common ways are:
/usr/local/redis/bin/redis-server /usr/local/redis/conf/sentinel.conf --sentinelor
/usr/local/redis/bin/redis-sentinel /usr/local/redis/conf/sentinel.confAfter 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 starting8181:X 17 Jun 2022 14:22:12.734 # Redis version=6.2.4, bits=64, commit=00000000, modified=0, pid=8181, just started8181:X 17 Jun 2022 14:22:12.734 # Configuration loaded8181:X 17 Jun 2022 14:22:12.735 * monotonic clock: POSIX clock_gettime8181: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 988662ff1703bd362453265278cabf459dddd0518181:X 17 Jun 2022 14:22:12.737 # +monitor master mymaster 192.168.20.24 6379 quorum 28181: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 63798181: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 6379Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
