-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redis cluster support for do_count_hit #40
base: master
Are you sure you want to change the base?
Conversation
… execute the pipeline
… to the same node
looks like this need to rebased if you get get a chance |
keys_in_cluster = | ||
for conn <- cluster_nodes, reduce: [] do | ||
acc -> | ||
{:ok, keys} = Redix.command(conn, ["KEYS", "*"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm new to Redis and just read enough docs to make #56 work but from what I've learned, KEYS command results in a global lock. Is it really OK to be using it here?
In light of #56, I think this can be implemented as a separate backend. The default one should be the simplest one, I think. |
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.