If the priority 0 hosts have votes:1 then yes, node 2 should become primary.
6 member + arbiter, 3 priority :0, 2 hosts down || click to expand...
s0 [primary] test> rs.conf().members.map(x => {return {host: x.host, votes: x.votes, priority:x.priority}})
[
{ host: 'mongodb-0-a:27017', votes: 1, priority: 1 },
{ host: 'mongodb-0-b:27017', votes: 1, priority: 0.5 },
{ host: 'mongodb-0-c:27017', votes: 1, priority: 0.5 },
{ host: 'mongodb-0-d:27017', votes: 1, priority: 0 },
{ host: 'mongodb-0-e:27017', votes: 1, priority: 0 },
{ host: 'mongodb-0-f:27017', votes: 1, priority: 0 },
{ host: 'mongodb-a:27017', votes: 1, priority: 0 }
]
s0 [primary] test> rs.status().members.map(x => {return {name: x.name, health:x.health, stateStr:x.stateStr}})
[
{
name: 'mongodb-0-a:27017', health: 0, stateStr: '(not reachable/healthy)'
},
{ name: 'mongodb-0-b:27017', health: 1, stateStr: 'PRIMARY' },
{
name: 'mongodb-0-c:27017', health: 0, stateStr: '(not reachable/healthy)'
},
{ name: 'mongodb-0-d:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-0-e:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-0-f:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-a:27017', health: 1, stateStr: 'ARBITER' }
]
There are scenarios where node 2 may not be in a position to assume primary though. If another remaining member (4, 5 or 6 ) have more recent writes than node 2 then node 2 will enter a catchup state. The node would report as Primary but would not process writes until caughtup.
See catchUpTimeoutMillis
Another possibility is that the priority: 0
members also have votes: 0
. This would lead to not enough votes to become primary as votingMembersCount: 4
requires a majorityVoteCount: 3
in this case add a vote or remove a vote/arbiter.
6 member + arbiter, 3 priority:0 votes:0, 2 hosts down || click to expand...
s0 [direct: secondary] test> rs.conf().members.map(x => {return {host: x.host, votes: x.votes, priority:x.priority}})
[
{ host: 'mongodb-0-a:27017', votes: 1, priority: 1 },
{ host: 'mongodb-0-b:27017', votes: 1, priority: 0.5 },
{ host: 'mongodb-0-c:27017', votes: 1, priority: 0.5 },
{ host: 'mongodb-0-d:27017', votes: 0, priority: 0 },
{ host: 'mongodb-0-e:27017', votes: 0, priority: 0 },
{ host: 'mongodb-0-f:27017', votes: 0, priority: 0 },
{ host: 'mongodb-a:27017', votes: 1, priority: 0 }
]
s0 [direct: secondary] test> rs.status().members.map(x => {return {name: x.name, health:x.health, stateStr:x.stateStr}})
[
{
name: 'mongodb-0-a:27017', health: 0, stateStr: '(not reachable/healthy)'
},
{ name: 'mongodb-0-b:27017', health: 1, stateStr: 'SECONDARY' },
{
name: 'mongodb-0-c:27017', health: 0, stateStr: '(not reachable/healthy)'
},
{ name: 'mongodb-0-d:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-0-e:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-0-f:27017', health: 1, stateStr: 'SECONDARY' },
{ name: 'mongodb-a:27017', health: 1, stateStr: 'ARBITER' }
]