This project is a simple implementation of a distributed Redis system using Go, HAProxy and Docker. The project is divided into three main parts:
- Redis Cluster: A Redis cluster with 3 master nodes
- Go Client: A Go client that connects to the Redis cluster and performs some operations
- HAProxy Load Balancer: A HAProxy load balancer that distributes the requests to the Redis cluster
To run the project, you need to have Docker installed on your machine. Then, you can run the following commands:
- Build the Docker images:
docker-compose build
- Run the Docker containers:
docker-compose up -d
- Check the logs:
docker-compose logs haproxy
To test the project, you can run the following command:
curl --location 'localhost:8081/key' --head
er 'Content-Type: application/json' --data '{"key": "hello", "value": "world"}'
The project has the following endpoints:
- GET /key: Get the value of a key
- POST /key: Set the value of a key
- DELETE /key: Delete a key
- GET /health: Check the health of the Redis cluster