-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DOCS-268 removed one option for replacing a replica set #176
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,42 +129,24 @@ directly. | |
Replacing a Member | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
There are two processes for replacing a member of a :term:`replica set`: | ||
Use this procedure to replace a member of a replica set when the host | ||
name has changed. This procedure preserves all existing configuration | ||
for a member, except its hostname/location. | ||
|
||
#. Remove and then re-add a member using the following procedure in | ||
the :program:`mongo` shell: | ||
Replacing a member is useful if you have an existing configuration | ||
and only want to change the hostname of a member rather than completely | ||
remove all configurations related to the existing/previous set member. | ||
|
||
.. code-block:: javascript | ||
Use :method:`rs.reconfig()` to change the value of the | ||
:data:`members[n].host` field to reflect the new hostname or port | ||
number. :method:`rs.reconfig()` will not change the value of :data:`members[n]._id`. | ||
|
||
rs.remove("mongo2.example.net:27018") | ||
rs.add({host: "mongo2.example.net:27019", priority: 0, hidden: true}) | ||
|
||
.. note:: | ||
|
||
The set member tracks its own replica set member ``_id``, | ||
which can cause conflicts when trying to re-add a previous member. | ||
|
||
To resolve this issue, you can either restart the | ||
:program:`mongod` process on the member that you're re-adding, or | ||
you can make sure that you specify an ``_id`` in the :method:`rs.add()` | ||
document. | ||
|
||
#. Use :method:`rs.reconfig()` to change the value of the | ||
:data:`members[n].host` field to reflect the new hostname or port | ||
number. In this case, the :data:`members[n]._id` field is not | ||
reused by the new member. | ||
|
||
.. code-block:: javascript | ||
|
||
cfg = rs.conf() | ||
cfg.members[0].host = "mongo2.example.net:27019" | ||
rs.reconfig(cfg) | ||
.. code-block:: javascript | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. blank line before this line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you add the blank line or should I? On Tue, Sep 4, 2012 at 4:06 PM, Sam Kleinman [email protected]:
|
||
|
||
The second method may be useful if you have an existing configuration | ||
and only want to change the hostname of a member rather than | ||
completely remove all configurations related to the existing/previous | ||
set member. The :data:`members[n]._id` field does not change as a | ||
result of this operation. | ||
cfg = rs.conf() | ||
cfg.members[0].host = "mongo2.example.net:27019" | ||
rs.reconfig(cfg) | ||
|
||
.. warning:: | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the following procedure to replace a member of a replica set when host names change. This operation preserves all existing configuration for a member, except its hostname/location.
Or something?