Mongodb can't start

后端 未结 6 1107
暖寄归人
暖寄归人 2020-12-08 21:48

today I updated my Mongo.. mongodb-stable (from 10gen repo)

but my service has down. the following command not working

$ sudo service mongodb start
         


        
相关标签:
6条回答
  • 2020-12-08 21:52

    Running Ubuntu 11.10 confirm you have the latest version of MongoDB:

    $ mongod --version

    db version v2.2.0

    (If you don't have the latest version of MongoDB, follow the Ubuntu Installation instructions at: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/)

    First confirm that the mongodb user/group has permission to write to the data directory:

    $ sudo chown -R mongodb:mongodb /var/lib/mongodb/.

    Start up MongoDB as a Daemon (background process) using the following command:

    $ mongod --fork --dbpath /var/lib/mongodb/ --smallfiles --logpath /var/log/mongodb.log --logappend

    To Shut Down MongoDB enter the Mongo CLI, access the admin and issue the shutdown command:

    $ ./mongo

    > use admin

    > db.shutdownServer()

    See: http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo

    0 讨论(0)
  • 2020-12-08 21:53

    you should have mentioned which LINUX distribution and version you are using..

    works fine for me on Fedora 13 and 14:

    # service mongod status
    mongod (pid 6403) is running...
    # service mongod stop
    Stopping mongod:                                           [  OK  ]
    # service mongod start
    Starting mongod: forked process: 7131
    all output going to: /data/mongo/log/mongod.log
                                                                   [  OK  ]
    

    what is the output of " chkconfig | grep mongo " on your system?

    if you don't get any output from the command above, then you still need to correctly configure mongod as a service with "chkconfig" (see 'man chkconfig')

    e.g.:

    chkconfig --add mongod
    chkconfig --level 35 mongod on
    

    afterwards you should get this output:

    # chkconfig | grep mongo
    mongod          0:off   1:off   2:off   3:on    4:off   5:on    6:off
    
    # service mongod status
    mongod (pid 6403) is running...
    
    0 讨论(0)
  • 2020-12-08 22:02

    Bug has been reported and fixed.

    https://jira.mongodb.org/browse/SERVER-2200

    $ sudo apt-get purge mongodb-stable 
    $ sudo apt-get install mongodb-stable 
    (remove the lock file if present in /var/lib/mongodb)  
    $ sudo init 6 
    

    Then edit /etc/init/mongodb.conf removing the line "limit nofile 20000"

    $ sudo vi /etc/init/mongodb.conf 
    $ sudo service mongodb start
    mongodb start/running, process 2351
    

    Worked.

    0 讨论(0)
  • 2020-12-08 22:05

    If process is not running but you still get this exeption - just delete "mongodb.lock" file in your mongodb/data folder

    0 讨论(0)
  • 2020-12-08 22:12

    I run ubuntu server 10.04 minimal installation in a chroot environment. I always have same massage even after I executed the above. Only the following sudo mongod -f /etc/mongodb.conf works, any hints?

    0 讨论(0)
  • 2020-12-08 22:17

    In shell launching $ mongo and # mongo I was able to find out that

    • /data/db is not present
      sudo mkdir -p /data/db
    • mongod is now an upstart
      sudo start --system mongod

    (valid for Ubuntu 14.04 trusty)

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