-
Notifications
You must be signed in to change notification settings - Fork 316
Too many Cluster redirections #67
Comments
Hi. This is abit tricky to debug remotely but i can give it a try :] When i see this usually there is a problem to connect to the cluster because when it sends the command it tries to connect to what it thinks is the node it should connect to but for some reason it can't after trying a number of times. I know i have seen this for example when running the cluster inside some virtual machine or docker container because there is a known bug there because when a client queries redis for its cluster nodes it will return the internal IP address of each node and not a valid external IP that can be accessed from outside of the VM/container. I would start by looking what your redis-cluster returnes when queried for the cluster information. I get the following output and can you paste your output?
I would expect that you will get something similar and that will explain why it will not work because this lib will parse that your nodes should exists on |
yes, it just got this(I didn't use slave)
I did't run cluster in any vm. how could I solve this problem. |
Tbh, i do not know how to solve this really because this is a problem that many people have and it exists inside redis and not inside this lib. One way would be not to use a virtualization layer and use a real server or run locally on the same machine. If you get behind some NAT like interface then redis fails. There might be a workaround inside the code however but i would not recommend it but if you want you could pass Another thing that could be interesting to experiment with is to build a cluster and use DNS names when joining the cluster together and see if redis reports back the dns names or if it translates it to the closest IP address like in your case. |
@pianoboysai Any progress on this? I would like to close this ticket as invalid because this is not a problem in this lib but in redis or how you setup your cluster. If possible could you try to build your cluster by providing the external IP addresses when you are are running redis-trib.rb. If my theory is correct then redis would internally track the external IP addresses for each node and when you run a cluster client it should get the correct IP addresses and it will work as expected. |
ok, thanks 2015-05-11 23:19 GMT-07:00 Grok notifications@github.com:
Best Regards, |
Hi @Grokzen, I faced this issue while testing on localhost.
I am testing the master-slave setup mentioned in this tutorial. My code:
If this helps:
|
@dharmit So you are running your nodes on the same machine that you are running your redis cluster? You are not running the cluster inside a VM, Docker container or other machine and your redis-py-cluster client on your local host? |
@Grokzen No VM. No Docker container. Same machine running redis-server and redis-py-cluster client. |
@dharmit The error is kinda generic and can mean alot of things but usually it means that the client get stuck inside this while loop https://github.com/Grokzen/redis-py-cluster/blob/unstable/rediscluster/client.py#L278 and the most common issue is that the IP address it gets back from the cluster is unreachable or wrong. If you are inside docker for example and you create a cluster, redis usually tracks 127.0.0.1 as the IP for the other nodes and it will work as long as the client is alos running from the inside but when you try to reach it from the outside then you get this kind of error. My suggestion is that you have to do some digging yourself inside the while loop i linked above. The code should throw a exception and you have to look what one of the three except blocks that gets caught and see what the exception says. I will guess that you get stuck in this one https://github.com/Grokzen/redis-py-cluster/blob/unstable/rediscluster/client.py#L301 but please share what you find in case there is some bug in the code. Could you state what python version and what version of redis-py-cluster you are using? unstable branch or 0.2.0 release? |
Python 2.7.9 I was performing sharding using |
Ye that is probably the cause of it but i can't tell what or why you get that error. I have never seen that error happening during resharding. I could try some things on my side and my setup to see if i can replicate the problem but you should really dig into your setup and see what the code is doing. |
@dharmit Any updates on your issues regarding this? I would really like to close these issues if they are still not applicable or invalid. |
@Grokzen no updates from my side at the moment. Please feel free to close it. |
when I tested in 127.0.0.1 ,everything is ok.
but when I tested in remote machine, it got this error every time.
my test code:
I used pip install, that version could not import "StrictRedisCluster"
from rediscluster import StrictRedisCluster
The text was updated successfully, but these errors were encountered: