-
Notifications
You must be signed in to change notification settings - Fork 43
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
MOVED ERROR in pipeline-API when increasing shards in existing redis cluster #172
Comments
Hi!
Yes, hiredis-cluster handles the MOVED redirects, updates the slot-to-node mapping and retries the command automatically. The user doesn't need to care about this and should not see the MOVED redirect.
I don't know all the problems of hiredis-vip but we have improved many things. It's better that you try the latest version of hiredis-cluster and check if the problem is still there. If there is still a problem in hiredis-cluster, we can try to fix it. |
We checked and it is problem with the latest client (hiredis-cluster) also. Exactly Same MOVED error. |
Interesting. How do you call the EVAL command with arguments? Hiredis-cluster is using the first key in the EVAL command to send the command to the right node. What is the contents of the Lua script? |
"EVAL %s 1 %s %b %d %d %s %d" (first %s is uuid) "local status = redis.call('SET', KEYS[1], ARGV[1] .. '&%#' .. ARGV[2] .. '&%#' .. ARGV[3] .. '&%#' .. ARGV[4], 'lak', ARGV[5], 'pak'); "
|
Thanks. I think there is no problem in the Lua script. I can see you call EVAL with one key and KEYS[1] is used for the key in the script. That's good. I found out now that redisClusterAppendCommand + redisClusterGetReply does not follow MOVED-redirects. I'm sorry I didn't find out before. The workaround is to use redisClusterCommand. It follows MOVED-redirects automatically. Another possibility is to use the async API. Or call cluster_update_route() when you get MOVED error and then try again using redisClusterAppendCommand + redisClusterGetReply. We can to look at how we can implement redirect handling for redisClusterGetReply in the future, but there is no plan right now. |
ok ok got it... Hoping to see it some day in future. Just two questions:
|
|
We tried doing cluster_update_route(cc) but seems like it didn't work. Errors were still there. What exactly it does cluster_update_route? |
It sends CLUSTER NODES (or CLUSTER SLOTS if configured to use it instead) to a Redis node to learn about which node owns each slot. It updates an internal table in the cluster context. |
Implementing redirects for the pipeline API seems like it's not strait-forward. Currently it is not planned. Have you considered using the async API? It is very efficient and it handles redirects and updates slot mapping in the background. |
We call below function
redisClusterAppendCommand which calls lua script and sets and gets stuff from redis.
and then call redisClusterGetReply(cntxt, &reply).
Our code continously executes both functions... Now during above process, we increased number of shards in our existing redis cluster. Then we observed during scaling, we saw below error on printing reply:
reply->type and reply->str came out to be REDIS_REPLY_ERROR and MOVED IP Address:port respectively.
Since clients dont need to care about internal nodes/shards, should the hirendis-vip handle it like retrying to moved node? Need help on this.
NOTE: We are using hirendis-vip
If above issue is fixed in hiredis-cluster, let me know.
The text was updated successfully, but these errors were encountered: