Stop: Unknown instance mongodb (Ubuntu)

前端 未结 5 2140
慢半拍i
慢半拍i 2020-12-14 16:06

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

sudo service mongodb start

It shows me \"mongodb start/running, process 3566

相关标签:
5条回答
  • 2020-12-14 16:29

    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.

    0 讨论(0)
  • 2020-12-14 16:47

    I faced exactly the same problem and did the followings:

    • Removed the file mongod.lock (in my case this file was located at /var/lib/mongodb/)
    • Used the following command from my mongo client

    mongo --repair

    And that fixed the issue. It may be noted that I had a system crash prior to this problem appeared. Therefore, what I believe, the problem was caused due to the unclean shutdown of the server demon.

    If you are unsure of the reason, you may wish to have a look at the log file (in my case I found it under /var/log/mongodb/). That might give you some useful hints.

    Thanks.

    0 讨论(0)
  • 2020-12-14 16:48

    The reason you get the Unknown instance error is because upstart is tracking the wrong PID for the instance of forked mongod process. But the proper solution to this is not running the process in foreground by removing fork=true line from the config like @GoingTharn suggesting, but rather helping upstart to capture the right PID of the forked process by adding

    expect daemon
    

    to the /etc/init/mongodb.conf

    0 讨论(0)
  • 2020-12-14 16:52

    I fixed it by myself. Below is what I did:

     apt-get install mongodb
    

    And overwrote .conf file. After that everything works fine. I hope this would help someone.

    0 讨论(0)
  • 2020-12-14 16:53

    I faced it as you had.Maybe it is because my computer crash unexpectedly.I use the command: sudo top(ubuntu), and I found mongo running.I killed it and start mongo.Every thing turns right.

    0 讨论(0)
提交回复
热议问题