We are upgrading our software which is going to require an update to our MongoDB database. We plan on doing it by making a copy of the existing ReplicaSet with a new name and making our updates to the new one and then switching when everything is ready. Both of these ReplicaSet will be on the same servers.

I've already created the new standalone database under its new name (Did mongodumop from the Primary and then Restored it as a standalone under its new name on same volume as the Primary). What I want to do now is change this new database from a standalone to a ReplicaSet without impacting the original Production ReplicaSet

I found - Convert a Standalone to a Replica Set http://docs.mongodb.org/manual/tutorial/convert-standalone-to-replica-set/

But this example just shows a single ReplicaSet and I just want to make sure that the procedure would still work with two databases on the same servers. The name of the ReplicaSet to be converted from a standalone is one of the mongo startup options ( --replSet ) in this example. Would that option need both the original and new ReplicaSrt names or just the new one to be converted from Standalone

2 Answers 2


To convert the standalone to a second replica set, without impacting the original replica set, you should follow directions for normal replica set setup, taking into account the following:

  1. Use a different replSet name for the new set
  2. Use a different dbpath for any new set members
  3. Use a different logpath for any new set members
  4. Setup the new members with different ports

If the above are accounted for then your 2 sets will be distinct and there will be no attempts between the 2 to communicate with each other. Please perform your rs.add() operations carefully as well, specifying the new member's ports rather than the old.

  • I want to confirm something that seems to be implied from your response and others I have talked to. Can I have a single instance of Mongod accessing multiple(in my case two) ReplicaSets or does each ReplicaSet require its own mongod instance? My original thought was to have both running under the same Mongod instance and be differentiated by their name. Since the internal structure was different and was being accessed by two different versions of the app, I thought having the two different names would be enough Commented Nov 18, 2014 at 18:34
  • Replica sets consist of mongod instances and each mongod can be tied to a single replica set only. By "mongod instance" do you really mean MongoDB client? In that case your application should be able to create multiple connections to 1 or more replica sets. Commented Nov 19, 2014 at 13:51
  • Thanks for the explicit confirmation about an instance of mongod only being able to be tied to a single ReplicaSet. I had seen it implied in notes and examples that always only had a single ReplicaSet being served, but hadn't realized that it was a restriction. With that in mind your answer was obviously the correct one and has been so updated Commented Nov 19, 2014 at 16:39

This is a very strange way of updating a replica set. The usual method is called "rolling update" and works like this:

  1. Shut down a secondary
  2. Update the MongoDB packages
  3. Follow the instructions for starting up the first time, if there are any
  4. Repeat steps 1 – 4 for all remaining secondaries
  5. Connect to the primary
  6. Let it step down using rs.stepDown(3600)
  7. Repeat steps 1 – 4

Update done, with minimal downtime (actually, just some 2 seconds for the election after the primary stepped down), no copying from here to there.

  • My original plan was because I was updating the client application and database content and not the MongoDB packages. When I did the Mongo packages update earlier I followed the path you just described Commented Nov 19, 2014 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .