Categorygithub.com/amirhnajafiz/distributed-redis
modulepackage
0.2.0
Repository: https://github.com/amirhnajafiz/distributed-redis.git
Documentation: pkg.go.dev

# README

logo

Distributed Redis

Creating a distributed Redis client with Golang and Strago. The idea is to create a clustering system for Redis clients, maybe a like a load balancer. Therefore, we can speed up the process of handling clients.

The load balancing logic in this project is so simple, it just counts the number of requests that each service handled before and everytime a new request comes, it sends that to the service with minimum number of requests.

How to use the project?

Clone the repository and start the balancing server:

go run main.go

This will allow you to send the following http requests:

Add a new item named mine and its value is yours

curl -X POST -d '{"key": "mine", "value": "yours"}' localhost:8080/api/data 

Get an item named mine

curl localhost:8080/api/data/mine 

Remove an item named mine

curl -X DELETE localhost:8080/api/data/mine 

Each time you make a request, you are using a different redis handler.

Test

You can set a redis cluster with docker compose:

docker-compose up -d