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 that directory, I've made /data/db and /log folder.
Here is my mongodb.config
which describes the basic config for my DB.
dbpath = /mongodb/data/db logpath = /mongodb/log/mongo.log logappend = true #bind ip = 127.0.0.1 port = 27017 fork = true rest = true verbose = true #auth = true #noauth = true
Additionally, I want to know what the #
means in the config file.
I put this file to /mongodb/bin
, /mongodb
is the directory I extracted the files into.
I opened terminal and entered ./mongod --config mongodb.config
and I got this back.
Juneyoung-ui-MacBook-Air:bin juneyoungoh$ ./mongod --config mongodb.config about to fork child process, waiting until server is ready for connections. forked process: 1775 all output going to: /mongodb/log/mongo.log ERROR: child process failed, exited with error number 100
How can I handle this error and what this means?
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.
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:
mongod.lock
file.mongod --dbpath /your/db/path --repair
mongod --dbpath /your/db/path
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With