Cannot log in mongod

I tried to get the configuration file set but it looks like something wrong with mongod. Does anyone know how to solve it?

$ mongod
2019-09-27T00:44:08.606+0800 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] MongoDB starting : pid=2101 port=27017 dbpath=/data/db 64-bit host=Huimins-MBP.Home
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] db version v4.2.0
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] allocator: system
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] modules: enterprise
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] build environment:
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] distarch: x86_64
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] target_arch: x86_64
2019-09-27T00:44:08.622+0800 I CONTROL [initandlisten] options: {}
2019-09-27T00:44:08.623+0800 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-09-27T00:44:08.623+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2019-09-27T00:44:08.623+0800 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-27T00:44:08.623+0800 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-27T00:44:08.623+0800 I CONTROL [initandlisten] now exiting
2019-09-27T00:44:08.623+0800 I CONTROL [initandlisten] shutting down with code:100

@Huimin_11970 I’ve highlighted the error in bold for you.

The lecture did not mention to create that file/directory. Where and how I should create it?

Which chapter and lecture are you currently on?

Chapter 1 Lecture Configuration file

Have a look at the lecture Chapter 1: The Mongod @ 4:26 it mentions that the directory needs to be created. The lab did say, “using what you’ve learned so far” but it would help if it was a bit more explicit.

Basically, any folder path in your config file must be created beforehand.

Hope it helps!

Hi @Huimin_11970,

As mentioned in the previous lessons, you need to create the directory being passed as dpath if it doesn’t already exist.

When you ssh into your vagrant machine, the current directory you are in will be /home/vagrant. You can check the same as below:

vagrant@m103:~$ pwd
/home/vagrant

Now here you can create the directory that you want to by using the following command:

vagrant@m103:~$ mkdir /data/db

Let me know if you have any more questions.

Thanks,
Muskan
Curriculum Support Engineer

It works! Thanks so much!

1 Like