Search code examples
mongodbserviceubuntu-14.04

How to stop mongod after "unkown instance" error


After running two mongodb instance, I can't stop mongod service. After executing:

$ sudo service mongod stop
Stop: Unkown instance

I know that this question have been asked but they are looking for how to avoid this error and I am looking for how to actually stop the mongod service after getting this error...


Solution

  • Running sudo service mongod start twice doesn't start mongo twice. It should be an idempotent operation meaning it only has an effect the first time if mongo wasn't running. Any attempts to start it afterwards will do nothing.

    Your message of Stop: Unkown instance will mean that it couldn't find any running Mongo processes to stop.

    To verify Mongo isn't running, try running

     sudo ps aux | grep -v grep | grep mongo
    

    If that returns nothing, then you don't have any mongo processes running.