MongoDB Documentation, Release 3.0.4 Convert a Master-Slave Deployment to a Replica Set To convert a master-slave deployment to a replica set, restart the current master as a one-member replica set. Then remove the data directories from previous secondaries and add them as new secondaries to the new replica set. This should return a document that resembles the following: db.isMaster() db.adminCommand({shutdown : 1, force : true}) mongod --replSet <setname> rs.initiate() rs.status() You can now follow the convert a standalone to a replica set (page 614) tutorial to deploy your replica set, picking up from the Expand the Replica Set (page 615) section. To permanently failover from a unavailable or damaged master ( A in the following example) to a slave ( B ): Warning: Removing local. * is irrevocable and cannot be undone. Perform this step with extreme caution. Note: This is a one time operation, and is not reversible. A cannot become a slave of B until it completes a full resync. 599 9.2. Replication Concepts 4. Restart mongod on B with the --master option. 3. Back up and move all data files that begin with local on B from the dbPath . 2. Stop mongod on B . 1. Shut down A . 5. Connect to the mongod with the mongo shell, and initiate the replica set with the following command: 4. Start the former master with the --replSet option, as in the following: 3. Back up your /data/db directories, in case you need to revert to the master-slave deployment. 2. Shut down the mongod processes on the master and all slave(s), using the following command while connected to each instance: 1. To confirm that the current instance is master, run: { "ismaster" : true, "maxBsonObjectSize" : 16777216, "maxMessageSizeBytes" : 48000000, "localTime" : ISODate("2013-07-08T20:15:13.664Z"), "ok" : 1 } When the command returns, you will have successfully deployed a one-member replica set. You can check the status of your replica set at any time by running the following command: Failing over to a Slave (Promotion)