What is Redis Sentinel used for in client discovery?
Redis Sentinel helps clients find the current master node automatically by monitoring Redis servers and providing the master address when requested.
Click to reveal answer
beginner
How does a Redis client discover the master node using Sentinel?
The client queries Sentinel with the command SENTINEL get-master-addr-by-name <master-name> to get the current master's IP and port.
Click to reveal answer
intermediate
What happens if the master node fails in a Redis Sentinel setup?
Sentinel automatically promotes a slave to master and updates its state. Clients querying Sentinel will then get the new master's address for continued operations.
Click to reveal answer
intermediate
Why is client discovery through Sentinel better than hardcoding master addresses?
Because Sentinel provides dynamic discovery, clients don’t need manual updates when failover happens, making the system more reliable and easier to maintain.
Click to reveal answer
beginner
Which Redis command do clients use to ask Sentinel for the master address?
Clients use SENTINEL get-master-addr-by-name <master-name> to get the current master's IP and port.
Click to reveal answer
What does Redis Sentinel provide to clients for discovery?
AA list of all slave nodes
BThe current master node address
CThe Redis configuration file
DThe client connection pool size
✗ Incorrect
Sentinel provides the current master node address so clients can connect to the right server.
Which command does a Redis client use to get the master address from Sentinel?
ACONFIG GET master
BSENTINEL slaves <master-name>
CINFO replication
DSENTINEL get-master-addr-by-name <master-name>
✗ Incorrect
The command SENTINEL get-master-addr-by-name returns the current master's IP and port.
What happens when the master fails in a Sentinel-managed Redis setup?
ASentinel deletes all data
BClients must manually reconnect to a new master
CSentinel promotes a slave to master automatically
DThe Redis server shuts down
✗ Incorrect
Sentinel automatically promotes a slave to master to keep the system running.
Why should clients use Sentinel for discovery instead of hardcoding the master address?
ATo handle failover automatically
BTo reduce network traffic
CTo increase Redis memory
DTo avoid using Redis commands
✗ Incorrect
Using Sentinel allows clients to automatically find the new master after failover.
Which of these is NOT a role of Redis Sentinel?
AClient connection pooling
BAutomatic failover
CMonitoring Redis servers
DProviding master address to clients
✗ Incorrect
Sentinel does not manage client connection pools; it monitors and manages failover.
Explain how Redis Sentinel helps clients discover the current master node.
Think about how clients avoid hardcoding addresses.
You got /4 concepts.
Describe what happens during a failover in a Redis Sentinel environment and how clients adapt.
Focus on the automatic promotion and client discovery process.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of Redis Sentinel in client discovery?
easy
A. To automatically find the current Redis master server
B. To store data persistently on disk
C. To increase the speed of Redis commands
D. To backup Redis data to the cloud
Solution
Step 1: Understand Sentinel's role and compare options
Redis Sentinel monitors Redis servers and helps clients find the current master automatically. Only To automatically find the current Redis master server describes this discovery role; others describe unrelated features.
Final Answer:
To automatically find the current Redis master server -> Option A
Quick Check:
Sentinel = master discovery [OK]
Hint: Sentinel helps clients find the master automatically [OK]
Common Mistakes:
Confusing Sentinel with data storage
Thinking Sentinel speeds up commands
Assuming Sentinel handles backups
2. Which Redis command is used to get the current master address from Sentinel?
easy
A. SENTINEL get-master
B. SENTINEL get-master-addr-by-name
C. SENTINEL find-master
D. SENTINEL master-address
Solution
Step 1: Recall the correct command syntax and verify options
The official Redis command to get master address is SENTINEL get-master-addr-by-name. Only SENTINEL get-master-addr-by-name matches the exact command; others are incorrect or invalid.
Final Answer:
SENTINEL get-master-addr-by-name <master-name> -> Option B
Quick Check:
Command = SENTINEL get-master-addr-by-name [OK]
Hint: Remember full command: SENTINEL get-master-addr-by-name [OK]
Common Mistakes:
Using incomplete or wrong command names
Omitting 'get-master-addr-by-name'
Confusing with other Sentinel commands
3. Given the command SENTINEL get-master-addr-by-name mymaster returns ["192.168.1.10", "6379"], what does this output represent?
medium
A. The IP and port of the Sentinel server
B. The IP and port of a Redis slave server
C. The IP and port of the current Redis master named 'mymaster'
D. An error message indicating master not found
Solution
Step 1: Understand the command output and match output meaning
The command returns a two-element array: IP address and port of the master. Since the command queries the master by name, the output is the master's IP and port.
Final Answer:
The IP and port of the current Redis master named 'mymaster' -> Option C
4. You run SENTINEL get-master-addr-by-name mymaster but get an empty array []. What is the most likely cause?
medium
A. The Redis server is down
B. The client is connected to a Redis slave
C. The command syntax is incorrect
D. The Sentinel does not know about a master named 'mymaster'
Solution
Step 1: Interpret empty array result and check possible reasons
An empty array means Sentinel has no info on the requested master name. If the master name is unknown to Sentinel, it returns empty; syntax errors cause errors, not empty arrays.
Final Answer:
The Sentinel does not know about a master named 'mymaster' -> Option D
Quick Check:
Empty array = unknown master name [OK]
Hint: Empty array means unknown master name to Sentinel [OK]
Common Mistakes:
Assuming Redis server down causes empty array
Thinking syntax error returns empty array
Confusing slave connection with empty result
5. You want your application to automatically connect to the current Redis master even if failover happens. Which approach using Sentinel is best?
hard
A. Use SENTINEL get-master-addr-by-name to fetch master IP and port dynamically before connecting
B. Hardcode the master IP and port in your app configuration
C. Connect directly to a Redis slave and promote it manually if needed
D. Use Redis CLI to manually check master and update app config
Solution
Step 1: Understand automatic master discovery and evaluate other options
Using Sentinel's command to get the master address dynamically allows the app to adapt to failovers. Hardcoding IP/port or manual checks do not handle failover automatically; connecting to slaves is not reliable for writes.
Final Answer:
Use SENTINEL get-master-addr-by-name to fetch master IP and port dynamically before connecting -> Option A
Quick Check:
Dynamic master discovery = best practice [OK]
Hint: Always fetch master address dynamically via Sentinel [OK]
Common Mistakes:
Hardcoding master address ignoring failover
Connecting to slaves for writes
Manual updates instead of automatic discovery
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.