OPTIONS

replSetStepDown

Description

replSetStepDown

Forces the primary of the replica set to become a secondary. This initiates an election for primary.

replSetStepDown has the following prototype form:

db.runCommand( { replSetStepDown: <seconds> , force: <true|false> } )

replSetStepDown has the following fields:

Field Type Description
replSetStepDown number Optional. A number of seconds for the member to avoid election to primary. If you do not specify a value for <seconds>, replSetStepDown will attempt to avoid reelection to primary for 60 seconds.
force Boolean Optional. New in version 2.0: Forces the primary to step down even if there are no secondary members within 10 seconds of the primary’s latest optime.

Warning

replSetStepDown forces all clients currently connected to the database to disconnect. This helps ensure that clients maintain an accurate view of the replica set.

New in version 2.0: If there is no secondary within 10 seconds of the primary, replSetStepDown will not succeed to prevent long running elections.

Example

The following example specifies that the former primary avoids reelection to primary for 120 seconds:

db.runCommand( { replSetStepDown: 120 } )