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://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-09-18T15:47:11.764+0000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, 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 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed

It doesnt mind if I try:

vagrant@m103:~$ mongo

Or:

vagrant@m103:~$ mongo --port 27000

Or:

vagrant@m103:~$ mongo --host 127.0.0.1:27000

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
vagrant@m103:~$

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

3 Likes