Skip to content

DOCS-2387 new steps format: configure secondary-only member #1609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# This file is, at the moment, a copy of
# /includes/steps-perform-maintenance-task-on-replica-set-members.yaml
title: Stop a Secondary
stepnum: 1
ref: stop-a-secondary
pre: |
In the :program:`mongo` shell, shut down the :program:`mongod` instance:
action:
language: javascript
code: db.shutdownServer()
---
title: Restart the Secondary as a Standalone on a Different Port
stepnum: 2
ref: restart-the-secondary-as-a-standalone-on-a-different-port
pre: |
At the operating system shell prompt, restart :program:`mongod`
as a standalone instance running on a different port and *without*
the :option:`--replSet <mongod --replSet>` parameter:
action:
language: sh
code: mongod --port 37017 --dbpath /srv/mongodb
---
ref: perform-maintenance-operations-on-the-secondary
stepnum: 3
title: Perform Maintenance Operations on the Secondary
pre: |
While the member is a standalone, use the :program:`mongo` shell to
perform maintenance:
action:
language: sh
code: mongo --port 37017
---
title: Restart ``mongod`` as a Member of the Replica Set
stepnum: 4
ref: restart-mongod-as-a-member-of-the-replica-set
pre: |
After performing all maintenance tasks, use the following procedure
to restart the :program:`mongod` as a member of the replica set
on its usual port.
action:
- pre: |
From the :program:`mongo` shell, shut down the standalone
server after completing the maintenance:
language: javascript
code: db.shutdownServer()
- pre: |
Restart the :program:`mongod` instance as a member of
the replica set using its normal command-line arguments or
configuration file.

The secondary takes time to :doc:`catch up to the primary
</core/replica-set-sync>`. From the :program:`mongo` shell, use the
following command to verify that the member has caught up from the
:replstate:`RECOVERING` state to the :replstate:`SECONDARY` state.
language: javascript
code: rs.status()
---
title: Perform Maintenance on the Primary Last
stepnum: 5
ref: perform-maintenance-on-the-primary-last
pre: |
To perform maintenance on the primary after completing maintenance
tasks on all secondaries, use :method:`rs.stepDown()` in the
:program:`mongo` shell to step down the primary and allow one of
the secondaries to be elected the new primary. Specify a 300 second
waiting period to prevent the member from being elected primary again
for five minutes:
action:
language: javascript
code: rs.stepDown(300)
post: |
After the primary steps down, the replica set will elect a new
primary. See :doc:`/core/replica-set-elections` for more
information about replica set elections.

Repeat steps
:ref:`step-2-perform-maintenance-task-on-replica-set-members-restart-the-secondary-as-a-standalone-on-a-different-port`,
:ref:`step-3-perform-maintenance-task-on-replica-set-members-perform-maintenance-operations-on-the-secondary`, and
:ref:`step-4-perform-maintenance-task-on-replica-set-members-restart-mongod-as-a-member-of-the-replica-set`
on the former primary.
...
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Prevent Secondary from Becoming Primary

.. default-domain:: mongodb

Overview
--------

To prevent a :term:`secondary` member from ever becoming a
:term:`primary` in a :term:`failover`, assign the secondary a priority
of ``0``, as described here. You can set this "secondary-only mode" for
Expand Down Expand Up @@ -35,6 +38,11 @@ you must first step down the current primary using
set <replica-set-reconfiguration-usage>` with :method:`rs.conf()` and
:method:`rs.reconfig()`.

Procedure
---------

.. include:: /includes/steps/configure-secondary-only-replica-set-member.rst

Example
-------

Expand Down