mongodb service is not starting up

前端 未结 21 681
野的像风
野的像风 2020-12-02 05:16

I\'ve installed the mongodb 2.0.3, using the mongodb-10gen debian package. Everything went well, except the service which is installed by default is not starting up when com

相关标签:
21条回答
  • 2020-12-02 05:29

    I had issue that starting the service mongodb failed, without logs. what i did to fix the error is to give write access to the directory /var/log/mongodb for user mongodb

    0 讨论(0)
  • 2020-12-02 05:29

    Install mongodb for ubuntu 14.04

    sudo nano /etc/apt/sources.list.d/mongodb-org-3.2.list
    
    echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
    
    sudo apt-get update
    
    sudo apt-get install -y mongodb-org=3.2.10 mongodb-org-server=3.2.10 mongodb-org-shell=3.2.10 mongodb-org-mongos=3.2.10 mongodb-org-tools=3.2.10
    
    0 讨论(0)
  • 2020-12-02 05:30
    sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
    sudo service mongodb start
    
    0 讨论(0)
  • 2020-12-02 05:31

    Please check your permissions for "data" folder. This is a permission issue, as linux users will face this issue due to SE linux permissions. So you change the ownerand group both to "mongodb" for the "data" folder

    0 讨论(0)
  • 2020-12-02 05:33

    1 - disable fork option in /etc/mongodb.conf if enabled

    2 - Repair your database

    mongod --repair --dbpath DBPATH
    

    3 - kill current mongod process

    Find mongo processes

    ps -ef | grep mongo
    

    you'll get mongod PID

    mongodb   PID     1  0 06:26 ?        00:00:00 /usr/bin/mongod --config /etc/mongodb.conf
    

    Stop current mongod process

    kill -9 PID
    

    4 - start mongoDB service

    service mongodb start
    
    0 讨论(0)
  • 2020-12-02 05:34

    I took a different approach:

    Background: I use mongodb, single node, local to my server, as a staging area.

    I installed mongo based on instructions available in MongoDB docs.

    So, this is not 'prime' infrastructure, does not need to be up all the time - but still essential.

    What I do: In my run script, I check if mongo is running using -

    if pgrep "mongod" >/dev/null 2>&1
    

    If it is not running, then I run

    sudo mongod &
    

    Been working like a charm, no setup etc.

    If your use case is similar, let me know if it works for you too.

    Good luck!

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