Redis cluster support for do_count_hit #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! As I mention here: #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.