Grokzen / redis-py-cluster

Python cluster client for the official redis cluster. Redis 3.0+.
https://redis-py-cluster.readthedocs.io/
MIT License
1.1k stars 315 forks source link

host_port_remap Ignored On MovedError #417

Closed micah-williamson closed 4 years ago

micah-williamson commented 4 years ago

My host port remap config is as follows:

[
  {'from_host': '10.28.7.170', 'from_port': 6379, 'to_host': '127.0.0.1', 'to_port': 6380},
  {'from_host': '10.28.8.175', 'from_port': 6379, 'to_host': '127.0.0.1', 'to_port': 6380}
]

If I redis-cli into the master node and flushall, the next command will failed with a MovedError. This is caught in client.py at line 680. When this happens, it will take the response on the move error and set that as the new master without remapping it with the host_port_remap. This causes a timeout when connecting if you are using tunnelling and have a different host/port than what the server responds with.

Screen Shot 2020-11-12 at 11 37 24 AM
micah-williamson commented 4 years ago

Not worth fixing if the issue described here isn't fixed: https://github.com/Grokzen/redis-py-cluster/issues/416