I recently installed mongodb on my vps, but it returned an error for me:
Jan 31 01:35:47 servidor-1 mongod[6960]: Error reading config file: No such file or directory Jan 31 01:35:47 servidor-1 mongod[6960]: try '/usr/bin/mongod --help' for more information
I'm using Ubuntu 18.04
Please do check or create this file.
/etc/systemd/system/mongodb.service
It specifies the location of the configuration file. It should either be /etc/mongodb.conf
or /etc/mongod.conf
depending on your machine.
#Unit contains the dependencies to be satisfied before the service is started.
[Unit]
Description=MongoDB Database
After=network.target
Documentation=https://docs.mongodb.org/manual
# Service tells systemd, how the service should be started.
# Key `User` specifies that the server will run under the mongodb user and
# `ExecStart` defines the startup command for MongoDB server.
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
# Install tells systemd when the service should be automatically started.
# `multi-user.target` means the server will be automatically started during boot.
[Install]
WantedBy=multi-user.target
After this run basic commands to check.
sudo systemctl enable mongodb.service
sudo systemctl start mongodb
sudo systemctl stop mongodb
sudo systemctl status mongodb
sudo systemctl restart mongodb
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.