Bird
Raised Fist0
Redisquery~10 mins

Sentinel architecture in Redis - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Sentinel architecture
Start: Redis Master
↓
Sentinel Monitors Master
↓
Detects Master Failure?
No→Continue Monitoring
Yes↓
Sentinel Votes for New Master
↓
Elect New Master
↓
Slaves Reconfigure to New Master
↓
Clients Redirected to New Master
↓
Sentinel Resumes Monitoring
Sentinel watches the master Redis server, detects failure, elects a new master, and updates slaves and clients.
Execution Sample
Redis
SENTINEL MONITOR mymaster 127.0.0.1 6379 2
SENTINEL FAILOVER mymaster
SENTINEL GET-MASTER-ADDR-BY-NAME mymaster
Sentinel monitors a master, triggers failover, and retrieves the current master address.
Execution Table
StepActionCondition/CheckResult/State Change
1Sentinel starts monitoring masterMaster reachable?Yes, monitoring continues
2Master fails (simulated)Master reachable?No, failure detected
3Sentinel nodes communicateQuorum reached?Yes, failover initiated
4Sentinel elects new masterNew master selectedOne slave promoted
5Slaves reconfigureSlaves point to new masterReplication continues
6Clients redirectedClients connect to new masterService restored
7Sentinel resumes monitoringMonitoring activeSystem stable
8EndNo further failureSentinel waits for events
💡 Sentinel stops failover process after new master is elected and system stabilizes
Variable Tracker
VariableStartAfter Step 2After Step 4After Step 6Final
Master StatusUpDownDownDownUp (new master)
Sentinel StateMonitoringDetecting failureFailover in progressFailover completeMonitoring
Slaves ConfigPoint to old masterPoint to old masterOne slave promotedAll point to new masterAll point to new master
Clients ConnectionTo old masterTo old masterFailover ongoingRedirected to new masterConnected to new master
Key Moments - 3 Insights
Why does Sentinel need a quorum before failover?
Sentinel nodes vote to avoid split-brain; quorum ensures majority agree on master failure before promoting a new master (see execution_table step 3).
What happens to slaves during failover?
One slave is promoted to master, and other slaves reconfigure to replicate from the new master (see variable_tracker Slaves Config after step 4 and 6).
How do clients know about the new master?
Clients are redirected to the new master after failover completes, ensuring continuous service (see execution_table step 6 and variable_tracker Clients Connection).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does Sentinel detect the master failure?
AStep 1
BStep 4
CStep 2
DStep 6
💡 Hint
Check the 'Condition/Check' column for 'Master reachable?' changing to 'No' in execution_table.
According to variable_tracker, what is the state of 'Master Status' after step 4?
AUp (new master)
BDown
CUnknown
DStarting
💡 Hint
Look at the 'Master Status' row under 'After Step 4' in variable_tracker.
If the quorum was not reached, what would happen in the execution_table flow?
ASentinel would continue monitoring without failover
BFailover would proceed anyway
CSlaves would be promoted automatically
DClients would be redirected immediately
💡 Hint
Refer to execution_table step 3 where quorum is checked before failover.
Concept Snapshot
Sentinel architecture monitors Redis master servers.
It detects failures by checking master availability.
Sentinel nodes vote to confirm failure (quorum).
On failure, a slave is promoted to master.
Slaves and clients are reconfigured to new master.
Sentinel resumes monitoring after failover.
Full Transcript
Redis Sentinel architecture involves multiple Sentinel nodes monitoring a Redis master server. They continuously check if the master is reachable. When a failure is detected, Sentinel nodes communicate and vote to confirm the failure, requiring a quorum to avoid mistakes. Once confirmed, Sentinel elects a new master by promoting one of the slaves. The other slaves reconfigure to replicate from the new master, and clients are redirected to connect to the new master. After failover, Sentinel resumes monitoring the new master to maintain high availability.

Practice

(1/5)
1. What is the main purpose of Redis Sentinel in a Redis setup?
easy
A. To compress Redis data for faster transmission
B. To store large amounts of data persistently
C. To monitor Redis servers and automatically handle failover
D. To provide a graphical user interface for Redis

Solution

  1. Step 1: Understand Sentinel's role

    Redis Sentinel monitors Redis servers to detect failures.
  2. Step 2: Identify Sentinel's key feature

    It automatically switches to a backup server if the main one fails, ensuring availability.
  3. Final Answer:

    To monitor Redis servers and automatically handle failover -> Option C
  4. Quick Check:

    Sentinel = automatic failover [OK]
Hint: Sentinel watches servers and switches on failure [OK]
Common Mistakes:
  • Confusing Sentinel with data storage
  • Thinking Sentinel provides UI
  • Assuming Sentinel compresses data
2. Which of the following is the correct way to start a Redis Sentinel instance using the command line?
easy
A. redis-sentinel /path/to/sentinel.conf
B. redis-server --sentinel /path/to/sentinel.conf
C. redis-cli sentinel start /path/to/sentinel.conf
D. redis-start sentinel /path/to/sentinel.conf

Solution

  1. Step 1: Recall Redis Sentinel startup command

    The correct command to start Sentinel is redis-sentinel followed by the config file.
  2. Step 2: Check each option

    redis-sentinel /path/to/sentinel.conf matches the correct syntax; others are invalid commands or flags.
  3. Final Answer:

    redis-sentinel /path/to/sentinel.conf -> Option A
  4. Quick Check:

    Sentinel starts with redis-sentinel command [OK]
Hint: Sentinel uses redis-sentinel command, not redis-server [OK]
Common Mistakes:
  • Using redis-server with --sentinel flag
  • Trying to start Sentinel via redis-cli
  • Using non-existent redis-start command
3. Given a Redis Sentinel setup monitoring a master named mymaster, what will the command redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster return?
medium
A. The configuration file path of Sentinel
B. The IP and port of the current master server
C. The list of all slaves under the master
D. An error because the command is invalid

Solution

  1. Step 1: Understand the command purpose

    The command queries Sentinel on port 26379 for the address of the master named 'mymaster'.
  2. Step 2: Identify expected output

    It returns the IP and port of the current master server Sentinel monitors.
  3. Final Answer:

    The IP and port of the current master server -> Option B
  4. Quick Check:

    get-master-addr-by-name returns master address [OK]
Hint: get-master-addr-by-name returns master IP and port [OK]
Common Mistakes:
  • Confusing master address with slave list
  • Expecting config file path as output
  • Assuming command is invalid
4. You configured Redis Sentinel but it never triggers failover when the master goes down. Which of the following is the most likely cause?
medium
A. Sentinel quorum is not reached due to insufficient Sentinel instances
B. The master server has persistence disabled
C. The Redis version is too new for Sentinel
D. The client application does not use SSL

Solution

  1. Step 1: Understand failover conditions

    Sentinel requires a quorum of Sentinel instances to agree before failover.
  2. Step 2: Analyze the cause of no failover

    If quorum is not reached, Sentinel will not promote a slave to master.
  3. Final Answer:

    Sentinel quorum is not reached due to insufficient Sentinel instances -> Option A
  4. Quick Check:

    Failover needs quorum agreement [OK]
Hint: Failover needs quorum; check Sentinel count [OK]
Common Mistakes:
  • Blaming persistence for failover
  • Assuming Redis version blocks Sentinel
  • Thinking SSL affects failover
5. In a Redis Sentinel cluster with 5 Sentinel nodes monitoring 3 Redis masters, how many Sentinel nodes must agree to trigger a failover for a master if the quorum is set to 3?
hard
A. At least 2 Sentinel nodes must agree
B. Only 1 Sentinel node needs to agree
C. All 5 Sentinel nodes must agree
D. At least 3 Sentinel nodes must agree

Solution

  1. Step 1: Understand quorum setting

    The quorum setting defines the minimum number of Sentinels that must agree to start failover.
  2. Step 2: Apply quorum to the cluster

    With quorum set to 3, at least 3 Sentinel nodes must agree to trigger failover.
  3. Final Answer:

    At least 3 Sentinel nodes must agree -> Option D
  4. Quick Check:

    Quorum = minimum agreeing Sentinels [OK]
Hint: Quorum number = minimum Sentinels needed for failover [OK]
Common Mistakes:
  • Thinking only 1 Sentinel is enough
  • Assuming all Sentinels must agree
  • Confusing quorum with total Sentinel count
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard