Skip to content

edits+readability: rs-remove-member #1079

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
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
55 changes: 26 additions & 29 deletions source/tutorial/remove-replica-set-member.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,32 @@ Remove Members from Replica Set

.. default-domain:: mongodb

You may remove a member of a replica set at any time; *however*, for best
For best
results always *shut down* the :program:`mongod` instance before
removing it from a replica set.
removing it from a :term:`replica set`.

.. versionchanged:: 2.2
Before 2.2, you *had* to shut down the :program:`mongod` instance
before removing it. While 2.2 removes this requirement, it remains
good practice.

To remove a member, use the
:method:`rs.remove()` method in the :program:`mongo` shell while
connected to the current :term:`primary`. Issue the
:method:`db.isMaster()` command when connected to *any* member of the
set to determine the current primary. Use a command in either
of the following forms to remove the member:

.. code-block:: javascript

rs.remove("mongo2.example.net:27017")
rs.remove("mongo3.example.net")

This operation disconnects the shell briefly and forces a
re-connection as the :term:`replica set` renegotiates which member
will be primary. The shell displays an error even if this
command succeeds.

You can re-add a removed member to a replica set at any time using the
:doc:`procedure for adding replica set members </tutorial/expand-replica-set>`.
Additionally, consider using the :ref:`replica set reconfiguration procedure
<replica-set-reconfiguration-usage>` to change the
:data:`~local.system.replset.members[n].host` value to rename a member in a replica set
directly.
In versions prior to 2.2, you *must* to shut down the :program:`mongod` instance
before removing it.

To remove a member:

1. Connect to the :term:`primary`.

If you do not know which member is the primary, connect to any member
and issue the :method:`db.isMaster()` command.

#. Use :method:`rs.remove()` in either of the following forms to remove
the member:

.. code-block:: javascript

rs.remove("mongo2.example.net:27017")
rs.remove("mongo3.example.net")

MongoDB disconnects the shell briefly and forces a re-connection as
the replica set runs a new election for primary. The shell displays
an error even if this command succeeds.

To add a member back to a replica set, see the :doc:`procedure for
adding replica set members </tutorial/expand-replica-set>`.