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.