简体   繁体   English

总是在“ sudo systemctl status mongod”命令上获得“活动:失败”

[英]Always get “Active: failed” on 'sudo systemctl status mongod' command

I followed this link to install MongoDB on my machine. 我按照此链接在机器上安装了MongoDB。 Everything was fine and it worked. 一切都很好,并且有效。 Currently, when I run sudo systemctl status mongod , I get this error: 当前,当我运行sudo systemctl status mongod ,出现此错误:

● mongod.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since سه<U+200C>شنبه 2019-05-21 15:50:14 +0430; 25min ago
     Docs: https://docs.mongodb.org/manual
  Process: 5278 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
 Main PID: 5278 (code=exited, status=1/FAILURE)

مه 21 15:50:14 [my-username] systemd[1]: Started High-performance, schema-free document-oriented database.
مه 21 15:50:14 [my-username] systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
مه 21 15:50:14 [my-username] systemd[1]: mongod.service: Unit entered failed state.
مه 21 15:50:14 [my-username] systemd[1]: mongod.service: Failed with result 'exit-code'.

This is what I have done after it was ok, that might have caused the problem: 确定之后,这就是我所做的事情,这可能导致了问题:

  • I decided to add mongodb extension using pecl . 我决定使用pecl添加mongodb扩展。 I was not able to make a new database, neither by MongodDB Compassm, nor by Sell. MongodDB Compassm或Sell都无法创建新数据库。
  • I uninstalled it. 我卸载了它。
  • I installed it from the same link and ran the same commands, but when I wanted to install it again, after running sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 command, I got gpg: unchanged: 1 at the end, not gpg: imported: 1 (RSA: 1) which I got for the first time. 我从同一链接安装了它并运行了相同的命令,但是当我想再次安装它时,运行sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6命令gpg: unchanged: 1 ,而不是gpg: imported: 1 (RSA: 1) ,这是我第一次得到。
  • I even deleted and recreated my dbPath folder ( /var/lib/mongodb ) which seems that the problem is somehow associated with this parameter which is on /etc/mongod.conf . 我什至删除并重新创建了dbPath文件夹( /var/lib/mongodb ),看来问题出在某种程度上与/etc/mongod.conf上的此参数有关。

When I run sudo systemctl status mongod , I still get Active: failed . 当我运行sudo systemctl status mongod ,我仍然保持Active: failed

What should I do to run MongoDB properly again and make its status Active: Running ? 我应该怎么做才能再次正确运行MongoDB并使它的状态为Active: Running

Update : This is my /etc/mongod.conf file: 更新 :这是我的/etc/mongod.conf文件:

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1


#processManagement:

security:
  authorization: "enabled"

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

I solved the problem by uninstalling MongoDB and installing a specific version of MongoDB, not the latest version, using this link . 我通过使用此链接卸载MongoDB并安装了特定版本的MongoDB而非最新版本解决了该问题。 This might not be the actual solution but works for now. 这可能不是实际的解决方案,但目前可以使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM