This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
rediscluster.cluster_failover() does not connect to the proper node #360
Labels
3.0.0
All issues that will be looked at for 3.0.0 release
Accepted
Accepted bug or enhancement
Accepting PR
type: bug
Description
I have a 9 node cluster with 3 masters, each master on its own machine. The node is cross-replicated so the 2 slaves on each machine are replicas of the other 2 non-local masters. I'm working on re-balancing the cluster by manually failing over a master after a machine has gone down and comes back up where two masters end up on one machine.
Expected
That the targeted slave node should be promoted to master and the associated master be demoted to a slave. I can do this successfully on this cluster via
redis-cli -h <host> -p <port> -a <password> CLUSTER FAILOVER FORCE
.Actual
Bug
The
node_id
argument in thecluster_failover
method does not get passed on toexecute_command
and is never used to identify the proper node to connect to. From rediscluster/client.py:It looks like the
option
argument gets used as key to identify the node via slot lookup and the master node for that slot gets returned. Also from rediscluster/client.py:arg[1], the
option
arg incluster_failover
, gets used to determine slot inself._determine_slot(*args)
slot
gets used to look up node to failover, which returns the master node where the slot is located rather than thenode_id
passed tocluster_failover
I was able to work around this and get the slave to initiate the failover by finding the target node in
rc.connection_pool.nodes.all_nodes()
and use it to establish the connection to that node and send theCLUSTER FAILOVER
command.Tasks
Allow
cluster_failover
to target a slave node by id to start a manual failover.The text was updated successfully, but these errors were encountered: