fix: Migrator throws Moved
error when connecting to cluster
#550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While connecting to a Redis Cluster Migrator run fails to
create_index
since the commands are executed using a Redis connection.In this scenario, there should be some way to distinguish between
Redis
andRedisCluster
in order to avoid:redis.exceptions.MovedError: 13099 as mentioned in #408 #412
With RedisCluster support there would be an option to execute these commands on primary nodes and we won't run into the MovedError
In this PR:
We can connect with RedisCluster using two ways:
get_redis_connection
method to allowcluster
parameter so it would be as straight forward as usingget_redis_connection(host='localhost', cluster=True)
get_redis_connection(url="redis://localhost:6379?cluster=true")
This resolves #408 and
resolves #412