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