Replica Set _id change after initialisation?

Good Evening

Is there any way to rescue a situation? My replica set is setup and working a treat. But you’re tool won’t validate it because I’m a tool and changed the naming convention of the set name. I’m unable to find a way around this?

I’ve tried the following:
using rs.reconfig after attempting to change the “_id” identifier but this won’t take because it cannot find what its looking for.
I’ve disconnected all nodes and stopped mongod processes and then restarted with new config.
I’ve attempted to nav to local and use db.system.replset.remove({}) as well as dropDatabase()
I’ve tried to configure a not 3 with new config and initialise from there but no.

I’m just booting ripping down the box and starting again. But is there an alternative. seems like something that might creep up in production worlds??

You’re faced with a double whammy:

  1. _id is immutable - I would imagine this was discussed in M001
  2. you cannot have two nodes running on the same port on the same machine

Therefore, the name of a replica set cannot be changed as mentioned here.

The quickest way around this is to:

  1. Shutdown/kill all the nodes
  2. Delete all the files in all 3 dbPaths
  3. Fix your config files, restart/recreate the replicate set

… no need to destroy your box

1 Like

Hi @Mark_Pointon,

I hope you found @007_jb’s response helpful.

For future reference, please reach out to us in the discussion forum before going through this step as you might loose your work. In chapter 3 you will be reusing the replica set that you have built in chapter 2.

Hope it helps!

~ Shubham