|
| 1 | +title: Shut down replica set members. |
| 2 | +level: 4 |
| 3 | +ref: shutdown-replica-set |
| 4 | +content: | |
| 5 | + Follow the procedure in :ref:`Stop a Replica Set <stop-replica-set>` |
| 6 | + to confirm that replica set members are |
| 7 | + :ref:`shut down <terminate-mongod-processes>`. |
| 8 | +
|
| 9 | + .. warning:: |
| 10 | + |
| 11 | + This step requires downtime as all replica members will need to be |
| 12 | + shut down. |
| 13 | +
|
| 14 | +--- |
| 15 | +title: Rename the replica set. |
| 16 | +level: 4 |
| 17 | +ref: rename-the-replica-set |
| 18 | +content: | |
| 19 | + Perform the following steps for each replica set member: |
| 20 | + |
| 21 | + a. Update the replica set name. |
| 22 | +
|
| 23 | + - If using a :ref:`configuration file <conf-file>`, set |
| 24 | + :setting:`replication.replSetName <replication.replSetName>` |
| 25 | + to the new name. |
| 26 | +
|
| 27 | + - If using the :binary:`~bin.mongod` startup command with |
| 28 | + the :option:`--replSet <mongod --replSet>` option, note down the |
| 29 | + new replica set name for use in step f. |
| 30 | + |
| 31 | + #. Start the replica set member on a different port without the |
| 32 | + :option:`--replSet <mongod --replSet>` option. |
| 33 | + |
| 34 | + #. Connect to the replica set member. |
| 35 | + |
| 36 | + #. Update the replica set name in the :ref:`local database |
| 37 | + <replica-set-local-database>` with the following commands: |
| 38 | +
|
| 39 | + .. code-block:: javascript |
| 40 | +
|
| 41 | + /* Set `newId` to the new replica set name */ |
| 42 | + var newId = '<new replica set name>' |
| 43 | +
|
| 44 | + var doc = db.getSiblingDB("local").system.replset.findOne() |
| 45 | + var oldId = doc._id |
| 46 | + doc._id = newId |
| 47 | + db.getSiblingDB("local").system.replset.save(doc) |
| 48 | + db.getSiblingDB("local").system.replset.remove({_id: oldId}) |
| 49 | +
|
| 50 | + #. :ref:`Shut down <terminate-mongod-processes>` the replica set |
| 51 | + member. |
| 52 | + |
| 53 | + #. Start the replica set member on its original port. |
| 54 | + |
| 55 | + - If using a configuration file, ensure that |
| 56 | + :setting:`replication.replSetName <replication.replSetName>` is |
| 57 | + set to the new replica set name. |
| 58 | + |
| 59 | + - If using the :binary:`~bin.mongod` startup command with |
| 60 | + the :option:`--replSet <mongod --replSet>` option, pass the new |
| 61 | + name of the replica set to the |
| 62 | + :option:`--replSet <mongod --replSet>` option. |
| 63 | + |
| 64 | +... |
0 commit comments