Hi! As I mention here: https://github.com/ExHammer/hammer-backend-redis/issues/39 we had problems using this with a Redis Cluster. Looking the documentation looks like the client connector needs to enable a cluster mode to make operations without the MOVED error.
When you try to execute a SET instruction in a cluster, if the node connected receives the record, you should receive the tuple {:ok, "OK"}.
When you try to execute a SET instruction in a cluster but the node connected is not able to store the record, then you should receive a Redix.Error with the moved error message: MOVED 991 127.0.0.1:6001. This means you need to save the record in that specific node.
First Approach to design the solution
Validate the MOVED error in the do_count_hit/5 function.
Parse the correct node direction from the redix error.
Create a new connection to that node.
This will happen any time when you are in a cluster, we need to validate the connections to avoid create many connections to the same node. I achieve this registering the node direction as name.
Feedback
I'd like to get feedback on this possible solution, other pending part is add tests for this, but I'm a little bit confusing on that part. What do you think? Maybe there are other solutions.
Hi! As I mention here: https://github.com/ExHammer/hammer-backend-redis/issues/39 we had problems using this with a Redis Cluster. Looking the documentation looks like the client connector needs to enable a cluster mode to make operations without the
MOVED
error.Replication
Possible Solution
SET
instruction in a cluster, if the node connected receives the record, you should receive the tuple{:ok, "OK"}
.SET
instruction in a cluster but the node connected is not able to store the record, then you should receive aRedix.Error
with the moved error message:MOVED 991 127.0.0.1:6001
. This means you need to save the record in that specific node.First Approach to design the solution
MOVED
error in thedo_count_hit/5
function.Feedback
I'd like to get feedback on this possible solution, other pending part is add tests for this, but I'm a little bit confusing on that part. What do you think? Maybe there are other solutions.