MongoDB: ERROR: child process failed, exited with error number 14

后端 未结 11 1985
攒了一身酷
攒了一身酷 2020-12-17 21:48

I run MongoDB on Mac:

Shave:mongodb_simple Logan$ ./bin/mongod -f conf/mongod.conf
about to fork child process, waiting until server is ready for connections         


        
11条回答
  •  太阳男子
    2020-12-17 22:12

    You started and probably shutdown mongo in the wrong way.

    1. TO START MONGODB

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

    • /data/db is the location of the db. If you haven't created one yet => type: mkdir /data/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

    2. 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.

    1. Find the mongodb process PID by typing: lsof -i:27017 assuming your mongodb is running on port 27017
    2. Type kill , replace by the value you found the previous command.

提交回复
热议问题