https://github.com/a-m-dev/redis-cluster-demo
simple clustering example with redis
https://github.com/a-m-dev/redis-cluster-demo
Last synced: 10 months ago
JSON representation
simple clustering example with redis
- Host: GitHub
- URL: https://github.com/a-m-dev/redis-cluster-demo
- Owner: a-m-dev
- Created: 2022-11-22T14:58:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-23T19:43:53.000Z (over 3 years ago)
- Last Synced: 2025-02-16T00:24:22.602Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 195 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Redis-cluster example
Hey 👋
what you need to do:
1. have `docker` + `docker compose` installed
2. pull the repo
3. run `yarn`
4. run `yarn seed:employees` after your pg instance is up
5. after compose file is done working, open browser and go to `localhost:5000` for seeing your redis commander GUI
6. open a new tab and go to `localhost:8081`
7. the express app has an endpoint `/:limit` => call it with multiple numbers
running `localhost:8081/3` will return you the data of 3 users
running `localhost:8081/5` will return you the data of 5 users
...
# What will happen?
we have 3 redis instances running in cluster mode. in each request, you will see that what ever service load balancer redirects the request will hit the database and update the cache.
But if you refresh to run the same query, load balancer will hit another service and the point is that request will not hit the database, redis will take over in this step!
## little note
Sorry if you see log or dev codes somewhere in project, this project is just a POC and completed overnight ☠️ 🍻