Get the App
SLTechnology News&Howtos  ›  Database  › 

The solution to the failure to start the service after CentOS installs MongoDB

Shulou Source: shulou.com Published: 2022-06-01 14:33:22 09月11日 Update

Today, according to the download wizard of the MongoDB official website to install MongoDB, the service of starting MongoDB was found to be unable to start.

After a whole night of hard work, I finally got it. I hope I can help comrades who have the same difficulties.

First of all, Google and du Niang have searched countless articles and made numerous attempts, all of which have failed.

Try 1: some people say it's because of SElinux, but they still can't start it after shutting down SElinux.

Try 2: modify var/lib/mongo permissions, increase write permissions, invalid.

Try 3: create a new Data directory, and then use mongod-- dbpath to configure the Data directory, which still doesn't work.

Try 4: modify / etc/init.d/mongod file permissions, still invalid.

Finally, I read the mongo.conf documentation in the / etc directory and learned something. And found an article on Baidu:

Http://www.cnblogs.com/YOUCAN/archive/2013/01/27/2879121.html

The article says:

Delete the file:

Rm / data/mongodb/mongo.lock-- linux

Del / data/mongodb/mongo.lock-- windows

Then execute:

. / mongod-- repair

So I found the mongod.lock file under / var/lib and deleted it.

Finally, in the execution of mongod-repair

And then start the mongod service successfully!

Hope to help comrades who install according to the official website and then can't start the service.

Tags: Attempts services files permissions directories comrades articles help same difficulties success things reasons guides official websites documents articles yes and will Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info Redmi Shulou Technology Microsoft