Redis Sentinel - How the new master is chosen?

1.2k views Asked by At

I'm trying to set up Redis Sentinel. I know that when a master goes down the sentinel pick up one of its slaves and promote it as master. I was wondering based on which attributes the new master is selected among the slaves and which slave got selected for being a new master?

1

There are 1 answers

0
Gawain On BEST ANSWER

After Sentinels election, the leader sentinel will do the following steps:

  1. Remove slaves already in down status from slave list.
  2. Remove slaves which disconnection time is more than ten times of down-after-milliseconds + master down time
  3. Select slave(s) by replica-priority(configured in slave)
  4. If multiple slaves are selected, sort them by sync offset, and select the most in-sync(maximum offset) slave.
  5. If there are still multiple selection, sort with RunId and select the smaller one.

So you can see the process order of master selection can be following order:

  • Disconnection time
  • Priority
  • Replication offset
  • Run Id