The method does not immediately step down the primary. If no
electablesecondaries are up to date with the primary, the primary waits up to
secondaryCatchUpPeriodSecs(by default 10 seconds) for a secondary to catch up. Once an electable secondary is available, the method steps down the primary.
Once stepped down, the original primary becomes a secondary and is ineligible from becoming primary again for the remainder of time specified by
For a detailed explanation of the method 's execution, see Behavior.Note
The method is only valid against the primary and throws an error if run on a non-primary member.
rs.stepDown()method has the following parameters:ParameterTypeDescription
The number of seconds to step down the primary, during which time the stepdown member is ineligible for becoming primary. If you specify a non-numeric value, the command uses
The stepdown period starts from the time that the
mongodreceives the command. The stepdown period must be greater than the
Optional. The number of seconds that
mongodwill wait for an electable secondary to catch up to the primary.
secondaryCatchUpPeriodSecsoverrides the default wait time of
rs.stepDown() method attempts to
terminate long running user operations that block the primary
from stepping down, such as an index build, a write operation or a
Availability of Eligible Secondaries¶
The method then initiates a catchup period where it waits up to
secondaryCatchUpPeriodSeconds, by default 10 seconds, for a
secondary to become up-to-date with the primary. The primary only steps
down if a secondary is up-to-date with the primary during the
catchup period to prevent rollbacks.
If no electable secondary meets this criterion by the end of the waiting period, the primary does not step down and the method errors.