From d8371476176218c283b0d1683af80cc604b03bb2 Mon Sep 17 00:00:00 2001 From: Bob Grabar Date: Tue, 4 Sep 2012 12:33:29 -0400 Subject: [PATCH 1/3] DOCS-268 removed one option for replacing a replica set --- source/administration/replica-sets.txt | 47 +++++++------------------- 1 file changed, 12 insertions(+), 35 deletions(-) diff --git a/source/administration/replica-sets.txt b/source/administration/replica-sets.txt index b117ef740f3..1cffaf0bc07 100644 --- a/source/administration/replica-sets.txt +++ b/source/administration/replica-sets.txt @@ -129,42 +129,19 @@ directly. Replacing a Member ~~~~~~~~~~~~~~~~~~ -There are two processes for replacing a member of a :term:`replica set`: - -#. Remove and then re-add a member using the following procedure in - the :program:`mongo` shell: - - .. code-block:: javascript - - 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) +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. + +Use :method:`rs.reconfig()` to change the value of the +:data:`members[n].host` field to reflect the new hostname or port +number. The :data:`members[n]._id` field does not change as a result of this +operation. +.. code-block:: javascript - 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:: From 47cb7597bf5bd85f1d861515ee3796047115640b Mon Sep 17 00:00:00 2001 From: Bob Grabar Date: Tue, 4 Sep 2012 17:36:41 -0400 Subject: [PATCH 2/3] DOCS-268 added a line break --- source/administration/replica-sets.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/administration/replica-sets.txt b/source/administration/replica-sets.txt index 1cffaf0bc07..50c3135d83f 100644 --- a/source/administration/replica-sets.txt +++ b/source/administration/replica-sets.txt @@ -137,6 +137,7 @@ Use :method:`rs.reconfig()` to change the value of the :data:`members[n].host` field to reflect the new hostname or port number. The :data:`members[n]._id` field does not change as a result of this operation. + .. code-block:: javascript cfg = rs.conf() From 527a3d0d90632870f8170c2dfdbf631730b22080 Mon Sep 17 00:00:00 2001 From: Bob Grabar Date: Tue, 4 Sep 2012 19:04:31 -0400 Subject: [PATCH 3/3] DOCS-268 edits to proc for replacing a replica set --- source/administration/replica-sets.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/administration/replica-sets.txt b/source/administration/replica-sets.txt index 50c3135d83f..f6ffbd2a60f 100644 --- a/source/administration/replica-sets.txt +++ b/source/administration/replica-sets.txt @@ -129,14 +129,18 @@ directly. Replacing a Member ~~~~~~~~~~~~~~~~~~ +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. + 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. Use :method:`rs.reconfig()` to change the value of the :data:`members[n].host` field to reflect the new hostname or port -number. The :data:`members[n]._id` field does not change as a result of this -operation. +number. :method:`rs.reconfig()` will not change the value of :data:`members[n]._id`. + .. code-block:: javascript