MongoDB: Difference between revisions

From iFixWiki
No edit summary
No edit summary
Line 20: Line 20:
# sudo systemctl start mongod
# sudo systemctl start mongod
# sudo systemctl status mongod
# sudo systemctl status mongod
== MongoDB fails to start immediately after installation ==
When running the command ''sudo systemctl start mongod'' an error will appear saying:
Failed to start mongod.service: Unit mongod.service not found.
'''Solution'''
Enter the command:
sudo systemctl enable mongod
This will link the service and allow it to start.


[[Category:Website Software]]
[[Category:Website Software]]

Revision as of 00:51, 19 February 2020

MongoDB is a database used to manage and create databases.

Issues

MongoDB fails to start

When running the command sudo systemctl status mongod the MongoDB server will fail to start with the message (code=exited, status=62)

Solution

Attempt to repair the MongoDB installation by running the command:

sudo mongod --repair

If this command fails and it shows the error Data directory /data/db not found create the directory using this command:

sudo mkdir -p /data/db

Then restart mongodb:

  1. sudo systemctl stop mongod
  2. sudo systemctl start mongod
  3. sudo systemctl status mongod

MongoDB fails to start immediately after installation

When running the command sudo systemctl start mongod an error will appear saying:

Failed to start mongod.service: Unit mongod.service not found.

Solution Enter the command:

sudo systemctl enable mongod

This will link the service and allow it to start.