繁体   English   中英

由于出现错误,MongoDB无法启动

[英]MongoDB couldn't start because have error

我最近在vps上安装了mongodb,但它为我返回了一个错误:

Jan 31 01:35:47 servidor-1 mongod [6960]:读取配置文件时出错:没有这样的文件或目录Jan 31 01:35:47 servidor-1 mongod [6960]:尝试'/ usr / bin / mongod-帮助”以获取更多信息

服务mongodb状态

我正在使用Ubuntu 18.04

请检查或创建此文件。

/etc/systemd/system/mongodb.service

它指定配置文件的位置。 根据您的机器,它应该是/etc/mongodb.conf/etc/mongod.conf

#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

之后,运行基本命令进行检查。

sudo systemctl enable mongodb.service
sudo systemctl start mongodb
sudo systemctl stop mongodb
sudo systemctl status mongodb
sudo systemctl restart mongodb

暂无
暂无

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

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