OPTIONS
翻译或纠错本页面

rs.stepDown()

Description

rs.stepDown(seconds)

Forces the current replica set member to step down as primary and then attempt to avoid election as primary for the designated number of seconds. Produces an error if the current member is not the primary.

The rs.stepDown() method has the following parameter:

Parameter Type Description
seconds number Optional. The duration of time that the stepped-down member attempts to avoid reelection as primary. If this parameter is not specified, the method uses the default value of 60 seconds.

This function disconnects the shell briefly and forces a reconnection as the replica set renegotiates which member will be primary. As a result, the shell will display an error even if this command succeeds.

rs.stepDown() provides a wrapper around the database command replSetStepDown.

←   rs.status() rs.syncFrom()  →
ON THIS PAGE