Reputation: 556
Whenever I try to use start mongo db using the command "mongo" it shows me the following error. I have removed the mongod.lock file from the /var/mongo/ directory but still I am facing this error.
MongoDB shell version: 2.4.8
connecting to: test
Fri May 2 11:36:02.667 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
exception: connect failed.
Can anyone suggest me some steps to restart my mongo db.
Upvotes: 0
Views: 655
Reputation: 434
Try This :
This problem could be solved by the below mentioned 4 steps
1) Remove .lock file
sudo rm /var/lib/mongodb/mongod.lock
2) repair the mongodb
mongod –repair
3) start the mongodb
sudo service mongodb start
4) start the mongo client
mongo
Upvotes: 0
Reputation: 2354
You mongod server might not be running or may be running on a different port.
Look for mongod info here: http://docs.mongodb.org/manual/reference/program/mongod/.
Also check if you can do a ping using command line.
ping 127.0.0.1:27017
Upvotes: 1