天天看點

MongoDB報錯: Failed to start mongod.service: Unit mongodb.service is masked

參考:http://club.verimake.com/topics/36

參考:http://stackoverflow.com/questions/37014186/running-mongodb-on-ubuntu-16-04-lts

關于MongoDB報錯: Failed to start mongod.service: Unit mongodb.service is masked,可按照以下步驟解決:

打開以下檔案:

sudo vim /etc/systemd/system/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
           

執行以下指令:

sudo systemctl enable mongod.service
sudo systemctl daemon-reload
sudo service mongod start