MongoDB Documentation, Release 3.0.4 2. Optionally, if m3.example.net is more than 10 seconds behind m1.example.net ‘s optime, and if you don’t need to have a primary designated within 10 seconds, you can force m1.example.net to step down by running: • mdb0.example.net - the current primary . • mdb1.example.net - a secondary . • mdb2.example.net - a secondary . 1. In a mongo shell, run rs.status() to ensure your replica set is running as expected. 2. In a mongo shell connected to the mongod instance running on mdb2.example.net , freeze mdb2.example.net so that it does not attempt to become primary for 120 seconds. 3. In a mongo shell connected the mongod running on mdb0.example.net , step down this instance that the mongod is not eligible to become primary for 120 seconds: rs.stepDown(120) mdb1.example.net becomes primary. Note: During the transition, there is a short window where the set does not have a primary. For more information, consider the rs.freeze() and rs.stepDown() methods that wrap the replSetFreeze and replSetStepDown commands. A replica set member becomes “stale” when its replication process falls so far behind that the primary overwrites oplog entries the member has not yet replicated. The member cannot catch up and becomes “stale.” When this occurs, you must completely resynchronize the member by removing its data and performing an initial sync (page 594). This tutorial addressed both resyncing a stale member and to creating a new member using seed data from another member. When syncing a member, choose a time when the system has the bandwidth to move a large amount of data. Schedule the synchronization during a time of low usage or during a maintenance window. MongoDB provides two options for performing an initial sync: rs.freeze(120) To force a member to become primary use the following procedure: Consider a replica set with the following members: Force a Member to be Primary Using Database Commands Changed in version 1.8. rs.freeze() The rs.freeze() provides a wrapper around the replSetFreeze database command. If you later want to make m1.example.net primary again while it waits for m3.example.net to catch up, issue the following command to make m1.example.net seek election again: This prevents m1.example.net from being primary for 86,400 seconds (24 hours), even if there is no other member that can become primary. When m3.example.net catches up with m1.example.net it will become primary. db.adminCommand({replSetStepDown: 86400, force: 1}) Resync a Member of a Replica Set 633 9.3. Replica Set Tutorials