Mongo cant start service

April 5, 2017 546 views
MongoDB Ubuntu 16.04

I reinstalle dmongo following this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04 but this is the result of sudo systemctl status mongodb

● mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2017-04-05 16:31:03 UTC; 6s ago
  Process: 14024 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
 Main PID: 14024 (code=exited, status=1/FAILURE)

Apr 05 16:31:02 nodejs-512mb-fra1-01 systemd[1]: Started High-performance, schema-free document-oriented database.
Apr 05 16:31:03 nodejs-512mb-fra1-01 mongod[14024]: error command line: unrecognized line in 'storage:'
Apr 05 16:31:03 nodejs-512mb-fra1-01 mongod[14024]: use --help for help
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Unit entered failed state.
Apr 05 16:31:03 nodejs-512mb-fra1-01 systemd[1]: mongodb.service: Failed with result 'exit-code'
3 Answers

Hi @tamburrinipietro89

The error is error command line: unrecognized line in 'storage:'

Can you post your /etc/systemd/system/mongodb.service and /etc/mongod.conf since one of them must have a reference to storage:

mongodb.service

[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

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:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

There's a mongod.log file but it only say things about data received qhen the db was working. Anyway i once runned it with sudo wich isn't a good practice, can be that i introduced some locks or things like that? I tried to uninstall and make a fresh install but nothin. Is there a way to remove mongodb and everything like it was never installed? Im yelling angains the terminal since a week or two

Have another answer? Share your knowledge.