Start without the --fork option

I’m presenting the following error when I try to launch my config file which is in the following path

Path for file = /data/mongod.conf

mongo.conf
storage:
dbPath: “/data/db”
systemLog:
path: “/data/logs/mongod.log”
destination: “file”
net:
bindIp : “127.0.0.1,192.168.103.100”
port: 27000
security:
authorization: enabled
processManagement:
fork : true

When I try to run the following command
mongod -config /data/mongod.conf

I get the following response
about to fork child process, waiting until server is ready for connections.
forked process: 7016
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the “–fork” option.

Please run as suggested without fork
Remove the fork from config file or comment it
–fork runs mongod in background
When you don’t use it mongod runs in foreground and throws error on your terminal if any issue with your config file
Please run and identify what is missing
Most likely directory or permissions issue

hi there. i’m having a similar issue. after taking --fork out, i get the
2019-09-21T18:08:37.245+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/data/log/mongod.log"

after i make the directory i get
2019-09-21T18:10:58.395+0000 I CONTROL [main] log file "/data/log/mongod.log" exists; moved to "/data/log/mongod.log.2019-09-21T18-10-58".

after further testing, seems like --bind_ip "127.0.0.1,192.168.103.100" is affecting the child process because running mongod --dbpath /data/db --logpath /data/log/mongod.log --fork --port 27000 works

alright final update:
seems the quotes was an issue for me. should have been
mongod --dbpath /data/db --logpath /data/log/mongod.log --fork --port 27000 --bind_ip localhost,"192.168.0.100"
or
mongod --dbpath /data/db --logpath /data/log/mongod.log --fork --port 27000 --bind_ip "127.0.0.1","192.168.103.100"

I still have the same issue

vagrant@m103:~$ mongod --dbpath /data/db --logpath /data/log/mongod.log --fork --port 27000 --bind_ip localhost,“192.168.0.100”

about to fork child process, waiting until server is ready for connections.

forked process: 2774

ERROR: child process failed, exited with error number 1

To see additional information in this output, start without the “–fork” option.

vagrant@m103:~$ mongod --dbpath /data/db --logpath /data/log/mongod.log --port 27000 --bind_ip “127.0.0.1”,“192.168.103.100”
2019-09-21T20:46:26.561+0000 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open “/data/log/mongod.log”

When i excute a validation script it gives me this message :
You need to bind the IP address 192.168.103.100

my config file is :
storage:
dbPath: “/data/db”
net:
bindIp : localhost,192.168.103.100
port: 27000
security:
authorization: enabled

I tried with quotes arround 192.168.103.100, but the same problem.
Can any one help plz?

Please check bindIp parameter

Try this
bind_ip: “127.0.0.1,192.168.103.100”
localhost also should work

Error thrown on your screen after removing --fork option clearly says it is unable to create logfile
Does /data/log directory exists?
Make sure dbpath and logpath dirs exist

Also “127.0.0.1”,“192.168.103.100” is not correct
Use
“127.0.0.1,192.168.103.100”

Your bindIp parameter is correct
I was referring to some old non YAML cfg file
Sorry for the confusion
Please try with ip
bindIp : “127.0.0.1,192.168.0.100”

Thank your for your reply. I do that but the same message displayed.

Can you paste the screenshots of the command you ran and the error
Are you able to ping localhost and the IP-192.168.0.100
Also cat /etc/hosts

Hi @Cheikh_47421 and @Alberto_86585,

Please check on the below points:

  • The directory mentioned for logpath /data/log exists and has the appropriate permissions

  • The correct bind_ip value should be “192.168.103.100,127.0.0.1”

Kindly get back if it still doesn’t work for you.

@Irakli_Tsaishvili_42049 -

Please see above for the correct format of bind_ip parameter usage.

Thanks,
Muskan
Curriculum Support Engineer

Thank you for your reply. I tried all combinations for ip but still give me the same message : you need to bind the ip adress …

Hi @Cheikh_47421,

I am able to run the validation script after launching mongod with the same configuration that you mentioned above.

Can you please re-create your config file with all the correct parameters and also make sure you provide proper indentation.

Let me know if it works or not.

Thanks,
Muskan
Curriculum Support Engineer

bellow a screnn shoot of comand, and the cat command. Ican ping localhost and 192.168.103.100 (not 192.168.0.100)
image

Is there a fixed number of sapces for indentation ?

It is not indentation issue

please check if in your vagrant environment, localhost is correctly mapped to 127.0.0.1
You have to modify the first line in your /etc/hosts
Change 127.0.1.1 to 127.0.0.1

Hi,

As per the screenshot, I can see that the value of localhost is correctly mapped to 127.0.0.1 so that does not seem to be the issue here.

You may try to ping localhost once and share the screenshot - ping localhost.

Also, just to confirm, are you able to launch mongod process successfully?
Can you share the output of ps -ef | grep mongo command?

Please use two spaces for your indentation and avoid using tabs.

Kindly let me know if it works.

Thanks,
Muskan
Curriculum Support Engineer

I can ping local host without a problem and mongod strat corrrectly. But the problem still .
image

I removed the quotes and finaly it works. Thank you very much for your help

1 Like