-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use node address instead of relying on loopback reported by redis #589
Conversation
This breaks the build since we run multiple Redis Servers on 127.0.0.1 using different ports. And I don't see how we can fix that. |
I didn't want to overcomplicate this, but it seems I'll have to (a little). Will push an update shortly. |
2144310
to
b2c5c54
Compare
b2c5c54
to
94ea195
Compare
Thanks. AFAIR I saw at least one similar report before. |
@vmihailenco It seems that your later commit 4237a34 "cluster: fix origin addr check" breaks this fix. Due to the port check you added in this commit, it will only correct only one of the node's address in a cluster. Hence, you'll see interleaved successful and failing accesses in the test if different keys used. By the way, what does commit 4237a34 aim for? |
See #771. That commit fixed the case when some/all cluster nodes are on the same host, e.g. I don't understand the part about "only correct only one of the node's address in a cluster". I believe that the only change is that now code also compares nodes ports. |
I think I get the point now. Assuming we have 3 nodes on one host, with port assigned as 7001-7003. They're reported as 127.0.0.1:700x in the cluster slots info. Now we're using ip 9.9.9.9 to access them from another host. The previous fix will set all nodes's address to 9.9.9.9:7001, while your fix will set them to 9.9.9.9:7001, 127.0.0.1:7002 and 127.0.0.1:7003. |
Yeah, you are right. I guess you'd like to get 9.9.9.9:7001, 9.9.9.9:7002 and 9.9.9.9:7003. Is this still a problem with latest Redis Cluster? Are there any other fixes?.. |
@vmihailenco Good job! This is really what I want to address. At least it is still a problem with Redis (v4.0.11) and go-redis (e3b56f7). And I don't see any other fix. I'm not sure if it is worth mentioning here. But taken the case mentioned by @dim , let's assume that node e8e1 (reported as 127.0.0.1:6379 in dim's case, now let it be 127.0.0.1:7000) is running inside a docker on host 10.0.0.120, and is port-mapped to 37000. Hence we can access it via the address 10.0.0.120:37000. When we connect to the cluster via address 10.0.0.120:6379 or 10.0.0.120:37000, node e8e1's address will be revised to 10.0.0.120:7000, which is still not correct. To be still correct in this special case, we probably need to introduce some bigger changes. One idea is to issue the What's your guys' opinion? |
I think the official recommendation for that case is to use I am reluctant to add anything more complex to go-redis because
|
I don't see any considerable drawbacks other than that it will take more time to create the cluster state. I understand your considerations. I think we can wait until more people think it is necessary or helpful even at the cost of complexity and longer startup time. |
Fix cluster loopback handling. Fixes #589
Use node address instead of relying on loopback reported by redis
Fix cluster loopback handling. Fixes #589
Not sure if this is a redis bug or a feature, but we have recently noticed
CLUSTER SLOTS
suddenly reporting:A similar issue was reported here