mongodb不能以服务方式正常启动,而可以用shell的方式启动的解决办法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb不能以服务方式正常启动,而可以用shell的方式启动的解决办法相关的知识,希望对你有一定的参考价值。

After running the repair I was able to start the mongod proccessor but as root, which meant that service mongod start would not work. To repair this issue, I needed to make sure that all the files inside the database folder were owned and grouped to mongod. I did this by the following:

  1. Check the file permissions inside your database folder
    1. note you need to be in your dbpath folder mine was /var/lib/mongo I went to cd /var/lib
    2. I ran ls -l mongo
  2. This showed me that databases were owned by root, which is wrong. I ran the following to fix this: chown -R mongod:mongod mongo. This changed the owner and group of every file in the folder to mongod. (If using the mongodb package, chown -R mongodb:mongodb mongodb)

I hope this helps someone else in the future.

以上是关于mongodb不能以服务方式正常启动,而可以用shell的方式启动的解决办法的主要内容,如果未能解决你的问题,请参考以下文章

Mongodb服务启动和停止

怎么启动mongodb shell

windows7 怎么启动mongodb

windows7 怎么启动mongodb

mongoDB创建windows服务启动解决

mongodb启动方法