MongoDB cannot start with fork?

Viewed 6697

I have a mongod.conf which contains

processManagement:
    fork: true

However when I run mongod --config ./conf/mongod.conf it gave me the error as following:

ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.
error Command failed with exit code 48.

Also when I start Mongodb with mongod --fork --logpath=./mongo.log it also gave me error as following:

ERROR: child process failed, exited with error number 100
To see additional information in this output, start without the "--fork" option.

It seems like I cannot start Mongodb with --fork option. How can I fix this problem? How can I set up Mongodb with my mongod.conf ?

BTW my Mongodb version is v4.0.4. Really appreciate

2 Answers

Please check your configuration file. Double check all directory such as logpath, dbpath, pidfilepath,... If you run by mongod user, make sure your directories own by that user.

mongod creates a socket file in tmp dir which can cause an error while restarting with different. Check the /tmp directory or logs file for mongo.

Related