簡體   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