Lab: Change the Default DB Path

I am working through this lab but getting an error. To start, I changed the conf file to

  dbPath: /var/mongodb/db
  bindIp: localhost
  port: 27000
  authorization: enabled

I then run the mongod --dbpath /var/mongodb/db command, which seems to successfully connect. I then run the command to create the new user so I can validate my work, but I get the error:

[js] Error: couldn't connect to server localhost:27000, connection attempt failed: SocketException: Error connecting to localhost:27000 ( :: caused by :: Connection refused :
exception: connect failed

Any ideas on how to correct?

There are quite many variables here @Eric_Kenney , but:

  • That command run will start mongo on --port 27017

(this is incomplete, so you can think through yourself)

For mongod to initialize, the paths (to db and log) directories must exist.

Can be created using mkdir -p <dir>

The command to run a config file is:

mongod --config <pathToConf>