Skip to content

edits+readability: rs-replace-member #1080

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
35 changes: 20 additions & 15 deletions source/tutorial/replace-replica-set-member.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@ Replace a Replica Set Member

.. default-domain:: mongodb

Use this procedure to replace a member of a replica set when the hostname
has changed. This procedure preserves all existing configuration
for a member, except its hostname/location.
This procedure changes the hostname for a member of a :term:`replica
set` but preserves all other configuration options.

You may need to replace a replica set member if you want to replace an
existing system and only need to change the hostname rather than
completely replace all configured options related to the previous
member.
The procedure can be useful if you must replace an existing deployment
with a new deployment. If the new deployment uses the same configuration
options but different hostnames, use this procedure.

Use :method:`rs.reconfig()` to change the value of the
:data:`~local.system.replset.members[n].host` field to reflect the new hostname or port
number. :method:`rs.reconfig()` will not change the value of
:data:`~local.system.replset.members[n]._id`.
To change the hostname for a replica set member, use
:method:`rs.reconfig()` to change the value of the member's
:data:`~local.system.replset.members[n].host` field. The
:method:`rs.reconfig()` method does not change the value of the
:data:`~local.system.replset.members[n]._id` field.

.. code-block:: javascript
.. example::

cfg = rs.conf()
cfg.members[0].host = "mongo2.example.net:27019"
rs.reconfig(cfg)
To change the hostname to ``mongo2.example.net`` for the replica set
member configured at ``members[0]``, issue the following sequence of
commands:

.. code-block:: javascript

cfg = rs.conf()
cfg.members[0].host = "mongo2.example.net"
rs.reconfig(cfg)

.. warning::

Expand Down