0
0
Redisquery~30 mins

Why Sentinel provides high availability in Redis - See It in Action

Choose your learning style9 modes available
Understanding Redis Sentinel for High Availability
📖 Scenario: You are managing a Redis database that needs to stay online even if some servers fail. To do this, you want to use Redis Sentinel, which helps keep your data available and your system running smoothly.
🎯 Goal: Build a simple Redis Sentinel configuration that monitors a Redis master server and automatically handles failover to a replica if the master goes down, ensuring high availability.
📋 What You'll Learn
Create a Redis master server configuration
Create Redis replica server configuration
Set up a Redis Sentinel configuration to monitor the master
Configure Sentinel to perform automatic failover
💡 Why This Matters
🌍 Real World
Redis Sentinel is used in real systems to keep databases running without interruption, even if some servers crash.
💼 Career
Understanding Redis Sentinel is important for roles like DevOps, backend developers, and system administrators who manage reliable data services.
Progress0 / 4 steps
1
Set up Redis master server configuration
Create a Redis configuration file named redis-master.conf with the following exact content: port 6379 and bind 127.0.0.1.
Redis
Need a hint?

Use the port directive to set the port and bind to restrict connections to localhost.

2
Set up Redis replica server configuration
Create a Redis configuration file named redis-replica.conf with port 6380, bind 127.0.0.1, and add replicaof 127.0.0.1 6379 to replicate the master.
Redis
Need a hint?

Use replicaof to tell the replica which master to follow.

3
Configure Redis Sentinel to monitor the master
Create a Redis Sentinel configuration file named sentinel.conf with port 26379, sentinel monitor mymaster 127.0.0.1 6379 1, and sentinel down-after-milliseconds mymaster 5000.
Redis
Need a hint?

The sentinel monitor command tells Sentinel which master to watch and how many Sentinels must agree before failover.

4
Enable automatic failover in Sentinel
Add to sentinel.conf the line sentinel failover-timeout mymaster 60000 to set failover timeout and sentinel parallel-syncs mymaster 1 to control replica sync during failover.
Redis
Need a hint?

These settings help Sentinel manage failover timing and how replicas sync after failover.