Lab - Change the Default DB Path: Can't shutdown mongod from the mongo shell

Hi there,

I’m at this point (or at least I think I have fulfilled the previous requisites):

Now that your config file has changed, you have to restart mongod so the server will reflect those changes.

But when I try to connect to the mongo shell I got an error message:

MongoDB shell version v3.6.14
connecting to: mongodb://
2019-09-18T15:47:11.764+0000 W NETWORK  [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused
2019-09-18T15:47:11.764+0000 E QUERY    [thread1] Error: couldn't connect to server, connection attempt failed :
exception: connect failed

It doesnt mind if I try:

vagrant@m103:~$ mongo


vagrant@m103:~$ mongo --port 27000


vagrant@m103:~$ mongo --host

Because mongod is not running. You simply start rather than restart with mongod -f path-to-your-config-file. You can confirm that no mongod is running with ps -aef | grep mongod | grep -v mongo.

1 Like

I get:

vagrant@m103:~$ ps -aef | grep mongod | grep -v mongo

mongod is not running. now, you just follow the instruction to start it with your new config file.