@@ -74,14 +74,15 @@ To force reconfiguration:
7474
7575 rs.reconfig(cfg, {force : true})
7676
77- This operation forces the replica set to elect a new primary. Often
78- this is the member with which your :program:`mongo` shell has a
79- connection .
77+ This operation forces the secondary to use the new configuration. The
78+ configuration is then propagated to all the surviving members listed
79+ in the ``members`` array. The replica set then elects a new primary .
8080
8181 .. note:: When you use ``force : true``, the version number in the
8282 replica set configuration increases significantly, by tens or
8383 hundreds of thousands. This is normal and designed to prevent set
84- version collisions if network partitioning ends.
84+ version collisions if there are forced reconfigs on both sides of
85+ a network partition and then the network partitioning ends.
8586
8687#. If the failure or partition was only temporary, shut down or
8788 decommission the removed members as soon as possible.
@@ -141,8 +142,9 @@ Reconfigure by "Breaking the Mirror"
141142~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
142143
143144This option selects a surviving :term:`replica set` member to be the new
144- :term:`primary` and to "seed" a new replica set. All other
145- members must resync from this new primary.
145+ :term:`primary` and to "seed" a new replica set. In this procedure, the
146+ member to be the new primary is referred to as ``A``. All other members
147+ will resync from this new primary.
146148
1471491. Stop the surviving :program:`mongod` instances. To ensure a clean shutdown, use
148150 an existing :term:`control script` or an invocation that resembles the
@@ -155,27 +157,32 @@ members must resync from this new primary.
155157 Set :option:`--dbpath <mongod --dbpath>` to the data directory of your
156158 :program:`mongod` instance.
157159
158- #. For all instances that will resync their data from the surviving
159- :program:`mongod`, move the data directory (i.e. :setting:`dbpath <mongod --dbpath>`)
160- from each surviving member to an archive . For example:
160+ #. Move the data directories (i.e. :setting:`dbpath <mongod --dbpath>`)
161+ for all the members except ``A``, so that all the members except ``A``
162+ have empty data directories . For example:
161163
162164 .. code-block:: sh
163165
164166 mv /data/db /data/db-old
165167
166- .. optional:: If you have a backup of the database you may instead
167- remove this data.
168-
169- #. Restart all :program:`mongod` instances with a new replica set
170- name. For example, if the old set name was ``rs0``, you would invoke the :program:`mongod`
171- instance with the following command line argument:
168+ #. Move ``A``'s ``local.*`` files so that ``A`` has an empty ``local``
169+ directory. For example
172170
173171 .. code-block:: sh
174172
175- mongod --replSet rs1
173+ mkdir /data/local-old
174+ mv /data/db/local* /data/local-old/
175+
176+ #. Restart the replica set members the usual way.
177+
178+ #. Connect to ``A`` in a :program:`mongo` shell and run :method:`rs.initiate()`
179+ to initiate the replica set.
180+
181+ #. Add the other set members using :method:`rs.add()`. For example, to add a member running
182+ on ``example.net`` at port ``27017``, you would issue this command:
183+
184+ .. code-block:: javascript
176185
177- See :setting:`replSet` and :option:`--replSet <mongod --replSet>`
178- for more information.
186+ rs.add("example.net:27017")
179187
180- #. On the new primary, add the other instances as members of the replica
181- set. For more information, see :doc:`/tutorial/expand-replica-set`.
188+ The added members will initial sync their data from ``A``.
0 commit comments