0

Couldn't connect to server 127.0.0.1:27017

ac@ac:/$ mongo
MongoDB shell version: 2.2.0
connecting to: test
Thu Oct 11 11:46:53 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
ac@ac L342U:/$

Mongodb Error-handling Add a comment
elijah
asked Oct 18 2021
edited Oct 18 2021

Answer

0

It indicates that MongoDB is terminating because there is an old lock file.
Step 1: Remove lock file.
sudo rm /var/lib/mongodb/mongod.lock
Step 2: Repair mongodb.
sudo mongod --repair
Step 3: start mongodb.
sudo start mongodb
Step 4: Check status of mongodb.
sudo status mongodb
It will release the locks and repair the mongoDB.

Add a comment
linuxhelp
asked Oct 18 2021
edited Oct 18 2021
Post your Answer