Sentinel architecture helps keep your Redis database safe and working well by watching over it and fixing problems automatically.
Sentinel architecture in Redis
sentinel monitor <master-name> <ip> <port> <quorum> sentinel down-after-milliseconds <master-name> <milliseconds> sentinel failover-timeout <master-name> <milliseconds> sentinel parallel-syncs <master-name> <number>
master-name is a name you give to your main Redis server.
quorum is how many Sentinel instances must agree a server is down before action.
sentinel monitor mymaster 127.0.0.1 6379 2
sentinel down-after-milliseconds mymaster 5000sentinel failover-timeout mymaster 60000This configuration sets up Sentinel to watch a Redis master server at IP 192.168.1.100 on port 6379. It requires 2 Sentinels to agree before marking the master down. It waits 10 seconds before deciding the master is down, allows 3 minutes for failover, and syncs one replica at a time.
sentinel monitor mymaster 192.168.1.100 6379 2 sentinel down-after-milliseconds mymaster 10000 sentinel failover-timeout mymaster 180000 sentinel parallel-syncs mymaster 1
Sentinel runs as a separate process alongside Redis servers.
Multiple Sentinel instances improve reliability by agreeing on server status.
Failover means switching to a backup Redis server automatically to keep your app running.
Sentinel architecture watches Redis servers to detect failures.
It automatically switches to backups to keep data available.
It helps manage Redis servers easily and reliably.
Practice
Solution
Step 1: Understand Sentinel's role
Redis Sentinel monitors Redis servers to detect failures.Step 2: Identify Sentinel's key feature
It automatically switches to a backup server if the main one fails, ensuring availability.Final Answer:
To monitor Redis servers and automatically handle failover -> Option CQuick Check:
Sentinel = automatic failover [OK]
- Confusing Sentinel with data storage
- Thinking Sentinel provides UI
- Assuming Sentinel compresses data
Solution
Step 1: Recall Redis Sentinel startup command
The correct command to start Sentinel isredis-sentinelfollowed by the config file.Step 2: Check each option
redis-sentinel /path/to/sentinel.conf matches the correct syntax; others are invalid commands or flags.Final Answer:
redis-sentinel /path/to/sentinel.conf -> Option AQuick Check:
Sentinel starts with redis-sentinel command [OK]
- Using redis-server with --sentinel flag
- Trying to start Sentinel via redis-cli
- Using non-existent redis-start command
mymaster, what will the command redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster return?Solution
Step 1: Understand the command purpose
The command queries Sentinel on port 26379 for the address of the master named 'mymaster'.Step 2: Identify expected output
It returns the IP and port of the current master server Sentinel monitors.Final Answer:
The IP and port of the current master server -> Option BQuick Check:
get-master-addr-by-name returns master address [OK]
- Confusing master address with slave list
- Expecting config file path as output
- Assuming command is invalid
Solution
Step 1: Understand failover conditions
Sentinel requires a quorum of Sentinel instances to agree before failover.Step 2: Analyze the cause of no failover
If quorum is not reached, Sentinel will not promote a slave to master.Final Answer:
Sentinel quorum is not reached due to insufficient Sentinel instances -> Option AQuick Check:
Failover needs quorum agreement [OK]
- Blaming persistence for failover
- Assuming Redis version blocks Sentinel
- Thinking SSL affects failover
Solution
Step 1: Understand quorum setting
The quorum setting defines the minimum number of Sentinels that must agree to start failover.Step 2: Apply quorum to the cluster
With quorum set to 3, at least 3 Sentinel nodes must agree to trigger failover.Final Answer:
At least 3 Sentinel nodes must agree -> Option DQuick Check:
Quorum = minimum agreeing Sentinels [OK]
- Thinking only 1 Sentinel is enough
- Assuming all Sentinels must agree
- Confusing quorum with total Sentinel count
Ready to prove it?
Pass the test and this pattern moves unknown
