Starting mongod fork, ERROR: child process failed,

2019-02-01 04:53发布

In attempting to run the command

mongod --fork --logpath /var/log/mongodb.log

On a amazon ec2 32 bit instance (Amazon Linux AMI release 2014.09), I run into the following error:

2015-02-18T18:14:09.007+0000 
2015-02-18T18:14:09.007+0000 warning: 32-bit servers don't have journaling    
enabled by default. Please use --journal if you want durability.
2015-02-18T18:14:09.007+0000 
about to fork child process, waiting until server is ready for connections.
forked process: 17116
ERROR: child process failed, exited with error number 1

I also notice no log file is created in the process.

10条回答
Root(大扎)
2楼-- · 2019-02-01 04:59

For anyone else running into this error [even if you run it with sudo] make sure that you state the filename of the log file as in: /var/log/mongodb.log. I had just the directory path as in /var/log/ since I miss read the mongo docs.

查看更多
时光不老,我们不散
3楼-- · 2019-02-01 05:01

I incorrectly set the log path to var/mongodb/db/mongo.log instead of /var/mongodb/db/mongo.log so Mongo was trying to access a non-existent folder in /home.

查看更多
4楼-- · 2019-02-01 05:04

I have deleted old

/var/run/mongodb/mongod.pid

and all worked.

查看更多
Luminary・发光体
5楼-- · 2019-02-01 05:08

If you have a keyfile, it is also possible that the permissions are too open. Make sure you set it to 0400

查看更多
成全新的幸福
6楼-- · 2019-02-01 05:09

I had the same thing and it turned out to be a permissions issue. If the owner of the child process cannot access the log path or the log path does not exist, it will fail.

What I did was put the log directory in my home directory:

mkdir ~/log
mongod --fork --logpath ~/log/mongodb.log

If you really want to put it in your /var/log directory, just change the permissions.

查看更多
贪生不怕死
7楼-- · 2019-02-01 05:10

I also had the same error, however I used sudo it and ran sudo mongod --fork --logpath /var/log/mongodb.log. As @jryancanty mentioned, it's simply a permissions error.

查看更多
登录 后发表回答