Replica set m103 with new members

I created a replica set with 3 members using 27011, 27012, 27013. I eventually closed all 3 and there are no primary or secondary in replica set m103-repl.
Now, when I try to add a new member to the same replica set with port 27001. I get error:

Here is my rs.config():

How do I remove the old members, add new members and reuse the same replica set name?
Is the replica set name important for validating my lab? If not, I can try using a different replica set name.

Chapter 2, lecture “Reconfiguring a Running Replica Set” talks about how to reconfigure rs.config(). Suggest you review that lecture and see how you get on. On the other hand, the simpler route is to shutdown all nodes, delete all data files and restart the mongod.

I think you have to be on the primary to add new nodes, or re-configure the set.

1 Like

Thanks guys. I was able to resolve my issue and complete the lab. Below is what I ended up doing in case you wanna know:

  1. I created a new mongod instance for one of old ports 27011 which was part of replica set.
  2. Connected to mongo shell with this port: mongo -port 27011.
  3. Did rs.status() and it said not initiated so I did rs.initiate()
  4. At this point 27011 became my primary for my replica set.
  5. I tried to add 27001 to my replica set but got unauthorized error. So I created admin user and tried again.
  6. This time I got error saying our replica set Id is not matching to the replica set id on port 27001.
  7. So I killed the three processes for port 27001, 27002, 27003. I deleted there dbpath directory and recreated their dbpath directory.
  8. Started new mongod process for the 3 ports. Stepped down 27011. This made 27001 primary.
  9. Added 27001 to my shard. Validated the lab and it passed.
1 Like

Good job!

But fyi, you actually didn’t need to step down 27011 because it shouldn’t even be part of your replica set in the first place. As per above, you just needed to shut it down or kill it before bringing up the 3 mongod nodes.

I know I didn’t need to stepdown port 27011 but I was skeptical if for my lab to validate should 27001 be primary or not. Regardles thanks 007_jb. Thanks for all your efforts not just this post but all the posts I have been reading so far. :slight_smile:

1 Like

Closing this thread as the issue has been resolved.