Failed to restart mongod.service : Unit mongod.ser

2019-08-18 07:35发布

There are a lot of variations for this question, on different forums. I tried a lot of things to get it to work. I am using AWS EC2 and MEAN by Bitnami, I tried connecting using Node JS and I realized that my monogodb service is not running. I checked it by running on the terminal (connected using Putty)

service mongod status

This is the error I get

mongodb.service Loaded:not-found (Reason: No such file or directory) Active: inactive(dead)

To try my luck, I tried

 sudo service mongod restart

And I get this error:

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

Now, just to probe more I tried looking if I have this service installed. I ran this command: ls /lib/systemd/system And it gave a huge list, but I couldn't find mongod.service anywhere.

My Ubuntu Ver: 16.04 I am guessing it's not present or maybe I am looking for the wrong stuff. Please let me know how do I get the service to run. I am sort of new to MongoDB and Bitnami.

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-18 08:19

Each Bitnami MEAN stack includes a control script that lets you easily stop, start and restart services.

The script is located at /opt/bitnami/ctlscript.sh.

To start all services:

sudo /opt/bitnami/ctlscript.sh start

To start a single service:

sudo /opt/bitnami/ctlscript.sh start <service name>

So to answer your question:

sudo /opt/bitnami/ctlscript.sh start mongod

You can obtain a list of available services and operations by running the script without any arguments:

sudo /opt/bitnami/ctlscript.sh
查看更多
登录 后发表回答