Adding member to replica set triggers election in 3.2.11?

27 views
Skip to first unread message

Astro

unread,
Apr 26, 2017, 7:48:21 AM4/26/17
to mongodb-user

What are the scenarios that causes mongodb to trigger an election on rd.add()?

In version 3.2.11, I have seen multiple times that adding/removing member to replica set does not trigger an election. 

Contrary, in version 2.6,  most of the times on rs.add()/rs.remove() calls the election would trigger election.

From docs, rs.add() can, in some cases, trigger an election. 

What are the possible situations that may trigger election?  How can I completely avoid the election during  rs.add()

PS: There are some scenarios where we don't want an election to be triggered.


Thanks in advance!






Kevin Adistambha

unread,
May 4, 2017, 9:04:35 PM5/4/17
to mongodb-user

Hi,

What are the scenarios that causes mongodb to trigger an election on rd.add()?

Generally, adding new nodes to a replica set shouldn’t trigger an election, unless you call rs.add() with a document that changes the default priority of the new node (see Pass a Member Configuration Document to rs.add()). In this case, the new node’s priority setting may trigger an election. For example, if the new node you’re adding is set to have a higher priority than the current Primary, an election could be triggered.

However, to be absolutely certain that the planned call to rs.add() won’t trigger an election, you may want to simulate the rs.add() call in your staging environment before executing it on your production environment.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages