0
0
Redisquery~30 mins

Multiple Sentinel instances in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Managing Multiple Redis Sentinel Instances
📖 Scenario: You are managing a Redis setup that uses Sentinel for high availability. To ensure reliability, you want to configure multiple Sentinel instances monitoring the same Redis master server.
🎯 Goal: Set up configuration data for three Redis Sentinel instances monitoring one Redis master server. Then, write a query to list all Sentinel instances monitoring the master, and finally add a command to check the master status from one Sentinel.
📋 What You'll Learn
Create a Redis hash called sentinel:master with the master server details.
Create three Redis hashes called sentinel:instance:1, sentinel:instance:2, and sentinel:instance:3 with Sentinel instance details.
Add a Redis set called sentinel:instances containing the keys of all Sentinel instances.
Write a Redis command to retrieve all Sentinel instances monitoring the master.
Write a Redis command to check the master status from Sentinel instance 1.
💡 Why This Matters
🌍 Real World
In real-world Redis deployments, multiple Sentinel instances monitor the master to provide high availability and automatic failover.
💼 Career
Understanding how to configure and query multiple Sentinel instances is important for roles like DevOps engineers, system administrators, and backend developers managing Redis clusters.
Progress0 / 4 steps
1
Create Redis hash for the master server
Create a Redis hash called sentinel:master with these fields and values: ip set to 192.168.1.100, port set to 6379, and name set to mymaster.
Redis
Need a hint?

Use the HSET command to create a hash with multiple fields.

2
Create Redis hashes for three Sentinel instances and a set of instances
Create three Redis hashes called sentinel:instance:1, sentinel:instance:2, and sentinel:instance:3. Each should have fields ip and port with these values respectively: (1) 192.168.1.101, 26379; (2) 192.168.1.102, 26379; (3) 192.168.1.103, 26379. Then create a Redis set called sentinel:instances containing the keys of these three Sentinel hashes.
Redis
Need a hint?

Use HSET for each Sentinel instance and SADD to add all instance keys to the set.

3
Retrieve all Sentinel instances monitoring the master
Write a Redis command to get all members of the set sentinel:instances, which lists all Sentinel instance keys monitoring the master.
Redis
Need a hint?

Use the SMEMBERS command to list all members of a set.

4
Check master status from Sentinel instance 1
Write a Redis Sentinel command to check the master status from Sentinel instance 1 by using SENTINEL get-master-addr-by-name mymaster.
Redis
Need a hint?

Use the SENTINEL get-master-addr-by-name command with the master name.