+
Skip to content
/ reluster Public template

🚦 Minimal Redis HA Cluster simulator for Replication and Sharding

License

Notifications You must be signed in to change notification settings

thuongtruong109/reluster

CI Status Pull count Redis Sentinel Commander License

Redis Cluster Banner

A complete, ready-to-run Redis Sentinel & Cluster playground with Docker Compose for
learning, testing, and deploying Redis in real-world scenarios.

📝 Overview

This project provides a hands-on Redis lab that covers both Sentinel and Cluster modes:

  • Redis Sentinel → High Availability & Automatic Failover
  • 📦 Redis Cluster → Sharding + High Availability

🎯 Goal: Help developers, DevOps, and students experiment, validate, monitor, and integrate Redis into production-like environments.

✨ Features

  • ✔ Quick Bootstrap – Start Sentinel & Cluster in seconds with Docker Compose
  • ✔ Automation Scripts – Health checks, failover tests, rollback, backups, slot rebalancing, integrity, and security scan
  • ✔ CI/CD Ready – GitHub Actions/GitLab CI for automated testing & deployment
  • ✔ Configurable – Easily adjust number of nodes, replicas, memory limits, persistence
  • ✔ Comprehensive Docs – Setup guides, architecture explanations, usage examples
  • ✔ Realistic Workloads – Simulate traffic with redis-benchmark and custom scripts
  • ✔ Data Persistence – RDB/AOF configurations for durability testing
  • ✔ Backup & Restore – Automated backup scripts and restore procedures
  • ✔ Failover Testing – Simulate node failures and observe automatic recovery
  • ✔ Scaling – Add/remove nodes and reshard data with minimal downtime
  • ✔ Monitoring Stack - Redis-Commander, Redis-Exporter, Prometheus, Grafana for real-time insights

👤 Who Is This For?

  • 👨‍💻 Backend Developers – Learn caching, pub/sub, queues, session storage
  • 🛠️ DevOps / SREs – Practice HA, failover recovery, monitoring, scaling
  • 🎓 Students / Learners – Experiment with Redis concepts in a safe sandbox
  • 🏗️ System Architects – Validate Redis as a distributed system building block

🏗️ Architecture

🔹 Sentinel Mode (HA + Replica Failover)

flowchart TD
   S1["🛰️ Sentinel 1"]
   S2["🛰️ Sentinel 2"]
   S3["🛰️ Sentinel 3"]
   M["🟥 Master (6379)"]
   R1["🟦 Replica 1 (6380)"]
   R2["🟦 Replica 2 (6381)"]

   S1 --> M
   S2 --> M
   S3 --> M
   M --> R1
   M --> R2
Loading
flowchart LR
    %% Before failover
    subgraph Left["Before Failover"]
        direction TB
        Sentinel1(Sentinel) --> Master1
        Sentinel2(Sentinel) --> Master1
        Sentinel3(Sentinel) --> Master1

        Master1([Master]) --> Slave1([Slave])
        Master1 --> Slave2([Slave])
    end

    %% After failover
    subgraph Right["After Failover"]
        direction TB
        Sentinel4(Sentinel) --> NewMaster
        Sentinel5(Sentinel) --> NewMaster
        Sentinel6(Sentinel) --> NewMaster

        OldMaster([Master Down]) --> Slave2([Slave])
        NewMaster([New Master]) --> Slave2
    end

    Left --> Right
Loading

🔹 Cluster Mode (Sharding + Replication)

flowchart LR
   M1["🟥 Master #1 (Slots 0–5460)"] --> R1["🟦 Replica #1"]
   M2["🟥 Master #2 (Slots 5461–10922)"] --> R2["🟦 Replica #2"]
   M3["🟥 Master #3 (Slots 10923–16383)"] --> R3["🟦 Replica #3"]
Loading

🤝 Contributing

We welcome you to contribute and help improve Reluster 💚

Fork → Hack → Test → PR. Here are a few ways you can get involved:

  • 🐛 Reporting Bugs: If you come across any bugs or issues, please check out the reporting bugs guide to learn how to submit a bug report.
  • ✨ Suggestions: Have ideas to enhance features? We'd love to hear them! Check out the contribution guide to share your suggestions.
  • ❓ Questions: If you have questions or need assistance, open discussions or join our to connect with other users and contributors.

📝 License

Distributed under the Apache 2.0 license. Copyright (c) 2025 Thuong Truong.

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载