Lab: Logging to a Different Facility Error

I’m trying to validate my lab, but every time I try to run mongod, Im met with this error: about to fork child process, waiting until server is ready for connections.
forked process: 337
child process started successfully, parent exiting

user@M103# mkdir -p /var/mongodb/db/
user@M103# mongod -f mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 337
child process started successfully, parent exiting
storage:
  dbPath: /var/mongodb/db/
net:
  bindIp: localhost
  port: 27000
systemLog:
  path: /var/log/mongodb/mongod.log
  destination: file  
security:
  authorization: enabled
processManagement:
  fork: true

I tried to remove processManagement and ran mongod, but there was no output

Also seeing the following error:

user@M103# mongod -f mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 432
ERROR: child process failed, exited with error number 48
To see additional information in this output, start without the "--fork" option.

If you have the fork: true and are running with mongod -f then it should create a log file in the location you specified in the config file. You can then cat this file for more information on any other errors.

If you don’t see a log file, then I would verify the user that is running the mongod command has permissions to read/write to the log directory.

Im using the IDE to test this so the user should have sufficient rights. Given that my path is, /var/log/mongodb/mongod.log wouldn’t that mean that the log file would be output there? Also why would the child process fail?

Also when I run the test, the output is:

[FAIL] "Mongod was started with the new logpath"

Did you launch mongod with the logpath /var/mongodb/logs/mongod.log?

I set the path as, path: /var/mongodb/logs/mongod.log so why would it throw that error?

You started mongod once

Trying to start it again with the same configuration (file) will generate an error since you cannot have 2 mongod accessing the same files, directories and addresses.

Most likely because you are missing the step where you are asked to create a specific user.

This issue was resolved.

Steps I took to solve:
stopped mongod
filled out config file
made dir for mongo.config
ran mongod -f mongod.config
created admin user
ran test

1 Like