Show me how to delete all replication files to start all over for port 27001, 27002, 27003

I’ve tried for too many hours and days to correct my earlier mistakes setting up a replication set for ports 27001, 27002, and 27003. Now I cannot delete the config files for replica set configuration info, so I’m asking for help. I’ve read and tried nearly all the post suggestions to get rs.initiate() to work, but there are mismatches in the Object_Id of the replica members, and I’m just want to wipe the slate clean and start over. I can create new replica sets on different ports with different replica names, but I CAN"T FIX IT for ports 27001, 27002, and 27003. Keep in mind that ALL MY OLDER replica sets WORK perfectly fine, when I log into them. This means all my set up steps were perfect for those sets. My underlying setups were correct and I have no errors re-starting the replication nodes of older constructions. I just messed up on ONE EFFORT and my admin login credentials into mongo don’t allow me to delete the conf files. Please help.
Here are the logs from 27001 and 27003 (the 2 sets that have mismatches in config):
2019-12-15T01:52:54.904+0000 I REPL [conn7] replSet set names do not match, ours: m103-repl; remote node’s: m103-example
2019-12-15T02:03:58.512+0000 I REPL_HB [replexec-1] Error in heartbeat (requestId: 27774) to 192.168.103.100:27002, response status: InvalidReplicaSetConfig: replica set IDs do not match, ours: 5df50ece5fd170c9ad15996e; remote node’s: 5df53f3df8917dd201152f36

And of course, all subsequent labs depend on EXACTLY this replica set on ports 27001, 27002, 27003. Just lovely.

Hi @Rufel_05530,

Here’s how:

  1. Find all the processes related to the mongod configs that were used for those three ports
    ps -ef | grep [m]ongo
  2. Kill the processes using the process id (i.e. the numbers in the first column from step 1)
    kill <process_id>
  3. Delete all the data and log files:
    rm -r /path/to/db/*
    rm /path/to/log/log_name.log

Now you can start to create the folders again, start up the mongods and create the replica set.

1 Like

Dear 007_jb,

You’re a life saver! Thank you sooooooooooo much!!! That worked!!! I changed your instructions a bit, to preserve all of my other replication sets: I did …

rm -r …/db/{1, 2,3}

Thanks again!!!

Glad to see that you used your initiative too. Good work! :+1:

2 Likes