redis-config-server is a custom high-availability management service designed to mimic the behavior of Redis Sentinel, with extended functionalities and enhanced stability. This server is built using Go and integrates with a Raft-based consensus algorithm to provide consistent and fault-tolerant monitoring of Redis master-slave setups.
redis-config-server can manage multiple Redis instances, handle failover scenarios, and respond to Redis Sentinel commands using the Redis protocol. It is a robust alternative for managing Redis clusters, offering better scalability and customization options.
- High Availability Management: Monitors Redis master and slave nodes, providing automated failover in case of node failure.
- Raft Consensus Algorithm: Ensures consistent state across multiple redis-config-server instances, offering fault tolerance and reliability.
- Redis Protocol Support: Compatible with Redis Sentinel commands such as
MONITOR
,RESET
,REMOVE
,MASTERS
,MASTER
, andINFO
. - Custom Command Processing: Easily extendable to support additional Redis commands.
- Real-time Monitoring: Continuously monitors the health of Redis instances and takes action based on their status.
- Go 1.16 or higher
- Redis 5.0 or higher
go-redis/redis/v9
library for Gohashicorp/raft
library for Go
git clone https://github.com/Praying/redis-config-server.git
cd redis-config-server
go build -o redis-config-server main.go
To start the redis-config-server, run the following command:
./redis-config-server
redis-config-server supports several Redis Sentinel commands:
Monitors a new master instance:
redis-cli -p 26379 SENTINEL MONITOR <master-name> <ip> <port> <quorum>
Resets monitoring for a specific master:
redis-cli -p 26379 SENTINEL RESET <master-name>
Removes a master from monitoring:
redis-cli -p 26379 SENTINEL REMOVE <master-name>
Lists all monitored master instances:
redis-cli -p 26379 SENTINEL MASTERS
Gets detailed information about a specific master instance:
redis-cli -p 26379 SENTINEL MASTER <master-name>
Provides general information about the redis-config-server instance:
redis-cli -p 26379 SENTINEL INFO
The server configuration is typically done via a Sentinel configuration file (sentinel.conf
). Ensure that your Redis instances and configurations are properly set up before starting the redis-config-server.
Contributions are welcome! Please feel free to submit a pull request or open an issue on GitHub.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -m "Add new feature"
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- HashiCorp Raft for the consensus algorithm.
- go-redis for the Redis client library.
- Redis for being a powerful in-memory data structure store.
This README provides a comprehensive overview of your project, instructions for setting it up, and details on how to use and contribute to the project. You can customize this further based on specific needs or additional features you implement.