简体   繁体   中英

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

I followed this link to install MongoDB on my machine. Everything was fine and it worked. Currently, when I run sudo systemctl status mongod , I get this error:

● 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 . I was not able to make a new database, neither by MongodDB Compassm, nor by 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.
  • 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 .

When I run sudo systemctl status mongod , I still get Active: failed .

What should I do to run MongoDB properly again and make its status Active: Running ?

Update : This is my /etc/mongod.conf file:

# 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 . This might not be the actual solution but works for now.

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.

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