Original Redis master node getting elected as master by sentinels after multiple failover test

I have setup a 3 node HA redis with Sentinel monitors on each of the nodes. I have the following configuration: RedisA - Master RedisB - Replica RedisC - Replica

with 3 Sentinels watching the Master. Everything works fine (I’m keeping all sentinels up, so no quorum problems):

  1. I stop the RedisA process and sentinels fails over to RedisB for Master, with RedisA and RedisC as slaves.
  2. I stop RedisB and it will failover and make RedisC master with RedisA and RedisB as slaves.
  3. I stop RedisC, RedisB becomes Master, with RedisA and RedisC as slaves.
  4. I stop RedisB. But now RedisA DOES NOT become master and RedisC becoming the master.
    I have checked “info replication” and “info sentinels”. All the three redis servers are giving identical results.
    Not sure, why RedisA (original master) is not getting elected as master when I am performing subsequent failover operations by command “redis-cli -p 6379 debug sleep 60”

Any help is greatly appreciated!

If I’ve understood your question correctly, you believe that in step 4, RedisA should be selected and made the master just because it was originally the master.

However, when a Redis Sentinel needs to choose a replica to promote during a failover, it evaluates various metrics of the available replicas to determine the best candidate. These metrics include

  1. the availability of the replica
  2. its replica-priority,
  3. the processed replication offset, and
  4. the lexicographical RUNID.

These conditions are considered in that order of priority.

Since you probably haven’t altered the default value configuration of replica-priority, all replicas have equal priority (i.e., #2), and RedisA will not receive a higher priority. To give RedisA a higher priority, you can adjust this parameter, with a lower value indicating a higher priority.

which parameter needs to be adjusted to choose RedisA, incase it is up and running, else choose the next active node?

Parameter replica-priority. Please read more here: High availability with Redis Sentinel | Redis