MongoDB Replica Set Failure

mongodbmongodb-3.0replication

Some background

I had an issue with my replica set the last 24 hours, where the members could not connect to each other, and I got errors such as; could not connect to …. the machine actively refused it; read error; connect error etc.

Things I did to try and resolve it:

  1. I rebooted my PC
  2. I restarted the servers a bunch of times

But nothing seemed to work. I could connect to each member via the shell, and each member status was SECONDARY.

Why I did this

On one of my members a kept getting a message that there was a problem or failure with my shutdown, and that there was some issue with the mongod.lock file (I can't remember the exact message…).

My resolution

Finally, I deleted the mongod.lock file in each member directory, boot up the members, and a connection was established and a vote took place.

My Question

Was this a wise move? What would be the preferred method?

Thank you for your input and help!

Best Answer

As per my original question, my solution was as follows:

My resolution

I deleted the mongod.lock file in each member directory, boot up the members, and a connection was established and a vote took place.

Thank you to Dmytro Shevchenko for assisting with clarification via his link, explaining that deleting the mongod.lock files are OK.