Fail to start mongod

I am trying to start mongod with the following command >

mongod --port 27000 --logpath //home/vagrant/first_mongod/mongod.log

getting the following error >

about to fork child process, waiting until server is ready for connections.
forked process: 1641
child process started successfully, parent exiting

when I check for the process I can see its up but I am not redirected to the mongod prompt

vagrant@m103:~/first_mongod$ ps -ef | grep mongo
vagrant 1641 1 1 09:49 ? 00:00:01 mongod --port 27000 --logpath /home/vagrant/first_mongod/mongod.log --fork
vagrant 1672 1415 0 09:51 pts/0 00:00:00 grep --color=auto mongo

If I kill the process and run again without --fork I get the below output and it just hangs

2019-11-18T09:53:21.239+0000 I CONTROL [main] log file “/home/vagrant/first_mongod/mongod.log” exists; moved to “/home/vagrant/first_mongod/mongod.log.2019-11-18T09-53-21”.

My vagrant is running on Windows 10 machine .

Appreciate the help

Thanks

Once mongod is started you connect to it with the mongo shell.

For mongod see https://docs.mongodb.com/manual/reference/program/mongod/

For mongo shell see https://docs.mongodb.com/manual/reference/program/mongo/

1 Like

You are correct .

managed to login using the command >

mongo --host 192.168.103.100 --port 27000

Hi @shlomi_06088,

I’m glad your issue got resolved :slight_smile: .

For any other users who might be facing the same issue. :arrow_down:

In this case, the mongod instance didn’t hang rather it was running. All the log data was being written to this file - “/home/vagrant/first_mongod/mongod.log.2019-11-18T09-53-21” and that’s why there was no log entries on the screen.

Here you can see, mongodb has created a new log file with the UTC timestamp appended to the current log file name. You can use the –logappend option to append new entries to the end of the existing log file when the mongod instance restarts and this will prevent MongoDB from creating new log files.

Thanks,
Shubham Ranjan
Curriculum Support Engineer