On my centos when I tried
mongdb
It starts.
But when I run it as service it wont start. What is the problem?
service mongodb start
Firstly, run service mongod status
It should return mongod is stopped
.
Now look in your mongo folder. There is probably a mongod.lock file in there. The only times I've seen this file created is when the power cord gets yanked out.
Remove the mongod.lock file: sudo rm mongod.lock
Start the service: sudo service mongod start
Take a look in the logs. Why do you think it dosen't started? Its a demon process, it runs in the background.
service mongod status
may help you.
Just try this command.
sudo rm mongod.lock
And
sudo service mongod restart
may help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.