About to fork child process, waiting until server is ready for connections. forked process: 6558 ERROR: child process failed, exited with 48

I have been trying to set up MongoDB on my Mac using homebrew. I used MongoDB’s Documentation to do that, everything is installed correctly on my mac. But when I start the MongoDB services and try to run MongoDB manually as a background process I come across this error.

mongod --config /opt/homebrew/etc/mongod.conf --fork ─╯
about to fork child process, waiting until server is ready for connections.
forked process: 6558
ERROR: child process failed, exited with 48

And I cannot even access Mongo Shell , this is what I get

mongosh ─╯
[1] 7036 killed mongosh

Hi @Shahima_khan ,
Can you display your configuration file please?
I think it Is set internally the fork option so you don’ t need to explicate the --fork option from the Shell.

Regards

1 Like

Hi @Shahima_khan ,
Can you see if the port 27017 isn’t busy from another process?
For example in Linux you can see that with the netstat command.

Regards

1 Like

@Fabio_Ramohitaj the port is not busy. I checked there was no port 27017

@Shahima_khan , can you try to change the port in the configuration file of mongo to 27018 and the restart the instance?

1 Like

@Fabio_Ramohitaj umm… what port? There is no field named as “port” in the configuration file.

You need to add the parameter port in the configuration file:

“net:
bindIp: 127.0.0.1
port: 27017”
https://www.mongodb.com/docs/manual/reference/configuration-options/#:~:text=net%3A,port%3A%2027017

1 Like

@Shahima_khan Yes, but change the number of port to 27018 as i mentioned before and restart the process

1 Like

@Shahima_khan

Yes. Can you attach the status of the service here?

Hi @Shahima_khan,
Are you able to connect to the instance with mongo --port 27018 or mongosh --port 27018?
Can you execute command like show dbs?

Regards

@Fabio_Ramohitaj Hey !!

No Im unable to connect to the instance using mongo --port 27018 or mongosh --port 27018

here is the result:-

╭─    ~ ──────────────────────────────────────── KILL ✘  01:50:14 AM  ─╮
╰─ mongo --port 27018                                                        ─╯
zsh: command not found: mongo

╭─    ~ ───────────────────────────────────────── 127 ✘    ─╮
╰─ mongosh --port 27018                                                      ─╯
[1]    9058 killed     mongosh --port 27018

╭─    ~ ──────────────────────────────────────── KILL ✘    ─╮
╰─

Regards!

Hello @Shahima_khan,

I just had the same issue and the problem for me was that I did not stop the services before running the ‘mongod --config /opt/hombrew/etc/mongod.conf --fork’ command. From reading the thread I believe your issue is the same.

Try running ‘brew services stop mongodb-community@{version}

Then run 'mongod --config /opt/hombrew/etc/mongod.conf --fork’.

Hope this helps!

1 Like

Except for testing you do not want to start mongod manually with

You should use brew to stop and start since it is the safest way to get clean shutdown.

1 Like

@Tuhrel_Johnson thank you!

Mine was solved after reinstalling MongoDB completely and installing Mongosh separately.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.