zahra.dgh
zahra.dgh

Reputation: 133

Redis Sentinel - How the new master is chosen?

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?

Upvotes: 2

Views: 1438

Answers (1)

Gawain
Gawain

Reputation: 1092

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

Upvotes: 2

Related Questions