hammer-backend-redis
hammer-backend-redis copied to clipboard
Problem connecting with Redis Cluster
Describe the bug
Recently we're trying to connect a redis cluster for use with Hammer, but we got an error that comes from Redix:

Following this: https://github.com/whatyouhide/redix/issues/240, looks like this error comes from Redix that doesn't have support for the redis cluster moved errors.
Not sure what is the best way to handle this, I think we can handle the errors coming from Redix and create a new connection for the correct node and using redix we can send and get the data.
oh interesting. I did not know also that was a thing .Thanks for linking the original issue. So what fixes it? I am unclear what moves does? seems that we would need to restart the pool to fix it?
I'm not sure how a redis cluster works, but looks like when you add a new record, it will stored in a certain connection, and if you need a record stored there, you need to execute the command in that particular connection:
But, nevermind, I'm still looking into this 👀
But if I added the records using the redis-cli, looks like you can add and get the data from any part of the cluster 🤔

Happy to help to add changes for this @epinault 😁
I added some changes here: https://github.com/ExHammer/hammer-backend-redis/pull/40
left some question in the MR. Happy to look at it more next week.
@epinault I think it is easier if eredis_cluster can be used for redis_cluster case
and for normal redis, the eredis package
Basically, to change the Redix dependency to eredis + eredis_cluster in favor of more features