redis-replication

pluginagentmarketplace's avatarfrom pluginagentmarketplace

Master Redis replication - master-replica setup, Sentinel for HA, failover handling, and read scaling patterns

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 31, 2025

When & Why to Use This Skill

This Claude skill provides a comprehensive technical runbook for mastering Redis replication and High Availability (HA). It covers master-replica configurations, automated failover using Redis Sentinel, and strategies for read scaling. Designed for DevOps engineers and Database Administrators, it includes production-ready configurations, monitoring metrics, and troubleshooting guides to ensure database reliability, minimize downtime, and optimize performance in distributed environments.

Use Cases

  • Setting up master-replica architectures to scale read operations and improve data redundancy across multiple nodes.
  • Implementing Redis Sentinel for automated health monitoring and failover handling to ensure 24/7 service availability.
  • Diagnosing and resolving critical replication issues such as synchronization failures, authentication errors, and replication lag.
  • Configuring split-brain prevention and quorum settings to maintain data consistency during network partitions.
  • Monitoring database health using key metrics like connected replicas and master link status for proactive maintenance.
nameredis-replication
descriptionMaster Redis replication - master-replica setup, Sentinel for HA, failover handling, and read scaling patterns
sasmp_version"1.3.0"
bonded_agent06-redis-clustering
bond_typePRIMARY_BOND
version"2.1.0"
last_updated"2025-01"
typeinteger
requiredfalse
enum[basic_replication, sentinel]
default2
max_retries5
backoff_strategyexponential
backoff_base_ms1000

Redis Replication Skill

Master-Replica Setup

Replica Configuration

replicaof master_ip 6379
masterauth your_password
replica-read-only yes
replica-serve-stale-data yes

Commands

REPLICAOF master_ip 6379   # Set master
REPLICAOF NO ONE           # Promote to master
INFO replication           # Check status

Sentinel (Auto-Failover)

Architecture

  Sentinel 1     Sentinel 2     Sentinel 3
      ↓              ↓              ↓
      └──────── Monitor ───────────┘
                   ↓
   Master ←──→ Replica 1 ←──→ Replica 2

Configuration

# sentinel.conf
port 26379
sentinel monitor mymaster 192.168.1.10 6379 2
sentinel auth-pass mymaster password
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1

Commands

# On Sentinel port
SENTINEL masters
SENTINEL get-master-addr-by-name mymaster
SENTINEL failover mymaster
SENTINEL replicas mymaster

Monitoring

INFO replication
# role:master|slave
# connected_slaves:2
# slave0:ip=...,port=...,state=online,offset=...,lag=0

Assets

  • sentinel.conf - Sentinel configuration
  • docker-compose-ha.yml - HA Docker setup

References

  • REPLICATION_GUIDE.md - Setup guide

Troubleshooting

Replica Not Syncing

INFO replication  # Check master_link_status

Fix: Check network, password, and firewall

Split-Brain Prevention

min-replicas-to-write 1
min-replicas-max-lag 10

Failover Not Triggering

Check: Quorum (need majority of Sentinels)


Error Codes

Code Name Recovery
R001 MASTERDOWN Check master or failover
R002 SYNC_FAILED Check network/auth
R003 QUORUM_LOST Restore Sentinel majority