0
0
Redisquery~30 mins

Sentinel architecture in Redis - Mini Project: Build & Apply

Choose your learning style9 modes available
Redis Sentinel Architecture Setup
📖 Scenario: You are managing a Redis database for a small online store. To ensure the database stays available even if the main Redis server fails, you want to set up Redis Sentinel. Sentinel monitors Redis servers and automatically switches to a backup if the main one goes down.
🎯 Goal: Set up a basic Redis Sentinel configuration to monitor a Redis master server and its replicas. This will help you understand how Sentinel works to keep your database available.
📋 What You'll Learn
Create a Redis master server configuration named redis-master with IP 192.168.1.100 and port 6379.
Create two Redis replica servers named redis-replica1 and redis-replica2 with IPs 192.168.1.101 and 192.168.1.102 respectively, both on port 6379.
Create a Sentinel configuration file that monitors the master server redis-master with quorum set to 2.
Add the final Sentinel configuration line to enable notification scripts.
💡 Why This Matters
🌍 Real World
Redis Sentinel is used in real-world systems to keep Redis databases available and automatically handle failover without manual intervention.
💼 Career
Understanding Sentinel configuration is important for roles like DevOps engineers, system administrators, and backend developers who manage reliable database systems.
Progress0 / 4 steps
1
Create Redis master and replica server configurations
Create three Redis server configuration entries as strings: redis_master with IP 192.168.1.100 and port 6379, redis_replica1 with IP 192.168.1.101 and port 6379, and redis_replica2 with IP 192.168.1.102 and port 6379.
Redis
Need a hint?

Use simple string variables to store IP and port in the format 'IP:port'.

2
Create Sentinel monitoring configuration for the master
Create a variable called sentinel_monitor that contains the Sentinel configuration line to monitor the master server named redis-master at IP 192.168.1.100 and port 6379 with quorum set to 2. The format should be: sentinel monitor redis-master 192.168.1.100 6379 2.
Redis
Need a hint?

Follow the exact format for the sentinel monitor command with the correct master name, IP, port, and quorum.

3
Add Sentinel configuration for down-after-milliseconds and failover timeout
Create two variables: down_after_milliseconds set to 'sentinel down-after-milliseconds redis-master 5000' and failover_timeout set to 'sentinel failover-timeout redis-master 10000' to configure Sentinel's timing settings for the master.
Redis
Need a hint?

Use the exact strings for down-after-milliseconds and failover-timeout with the master name and values.

4
Add final Sentinel configuration to enable notification scripts
Create a variable called notification_script with the value 'sentinel notification-script redis-master /var/redis/notify.sh' to enable notification scripts for the master server.
Redis
Need a hint?

Use the exact string to enable notification scripts for the master.