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:
- I rebooted my PC
- 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…).
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.
Was this a wise move? What would be the preferred method?
Thank you for your input and help!
As per my original question, my solution was as follows:
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.
please create keyFile and place in each server , put the keyFile in config file, you can create keyFile using below command
openssl rand -base64 741 > mongodb-keyfile chmod 600 mongodb-keyfile
you can put the keyFile in config file using below option and start the replication
keyFile = /path/to/keyFile
AND One more thing is if your system belongs to any domain, it should be in that vpn itself to communicate, you can try ping those server whether they can send packets or not.