install mongoDB (child process failed, exited with error number 100)

后端 未结 9 1379
梦谈多话
梦谈多话 2020-12-08 10:21

I tried to install mongoDB on my macbook air.

I\'ve downloaded zipped file from official website and extract that file and move to root directory. After that, under

相关标签:
9条回答
  • 2020-12-08 11:18

    The data folders you created were very likely created with sudo, yes? They are owned by root and are not writable by your normal user. If you are the only user of your macbook, then change the ownership of the directories to you:

    sudo chown juneyoungoh /data
    sudo chown juneyoungoh /data/db
    sudo chown juneyoungoh /data/log
    

    If you plan on installing this on a public machine or somewhere legit, then read more about mongo security practices elsewhere. I'll just get you running on your macbook.

    0 讨论(0)
  • 2020-12-08 11:20

    I had a similar issue and it was not related to any 'sudo' problem. I was trying to recover from a kernel panic!

    When I look at my data folder I found out a mongod.lock file was there. In my case this page helped a lot: http://docs.mongodb.org/manual/tutorial/recover-data-following-unexpected-shutdown/. As they explain,

    if the mongod.lock is not a zero-byte file, then mongod will refuse to start.

    I tested this solution in my environment and it works perfectly:

    1. Remove mongod.lock file.
    2. Repair the database: mongod --dbpath /your/db/path --repair
    3. Run mongod: mongod --dbpath /your/db/path
    0 讨论(0)
  • 2020-12-08 11:20

    It's because you probably didn't shutdown mongodb properly and you are not starting mongodb the right way. According your mongodb.config, you have dbpath = /mongodb/data/db - so I assume you created the repository /mongodb/data/db? Let me clarify all the steps.

    1. TO START MONGODB

    In your mongodb.config change the dbpath = /mongodb/data/db to dbpath = /data/db. On your terminal create the db repository by typing: mkdir /data/db. Now you have a repository - you can start your mongo.

    To start mongo in the background type: mongod --dbpath /data/db --fork --logpath /dev/null.

    • /data/db is the location of the db.
    • --fork means you want to start mongo in the background - deamon.
    • --logpath /dev/null means you don't want to log - you can change that by replacing /dev/null to a path like /var/log/mongo.log

      1. TO SHUTDOWN MONGODB

    Connect to your mongo by typing: mongo and then use admin and db.shutdownServer(). Like explain in mongoDB

    If this technique doesn't work for some reason you can always kill the process.

    Find the mongodb process PID by typing: lsof -i:27017 assuming your mongodb is running on port 27017

    Type kill <PID>, replace <PID> by the value you found the previous command.

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