Stop: Unknown instance mongodb (Ubuntu)

senthil picture senthil · Nov 9, 2012 · Viewed 24.4k times · Source

I am new to Mongodb. When I run the following command:

sudo service mongodb start

It shows me "mongodb start/running, process 3566". But when I try to stop by giving the below command:

sudo service mongodb stop

It shows stop: Unknown instance:. Do anybody have any idea how to slove this issue.

And if I give sudo service mongodb restart, I'm getting the below message:

stop: Unknown instance: 
mongodb start/running, process 3644

PS: If I'm using just mongod, I could start the server and could connect the mongo shell by giving mongo.

Please suggest me how to fix the issue and how to connect mongo shell after giving service mongodb start. Thanks in advance.

Answer

GoingTharn picture GoingTharn · Feb 19, 2013

I just ran into this. Chances are the issue is in your conf file (obviously, since you reinstalled the seeded)

In the mongodb.conf do not set fork = true if calling it as a service. This will prevent the service call from being able to access it with service mongodb.conf status/stop/restart.

Removing a fork=True line, however, will alleviate the issue.

See comments; use the other solution even though this one is accepted.