Error couldn't connect to server 127.0.0.1:27000

Hello,
I am using Mac and currently not able to do lab 1.

In my first shell I’m connected to mongod --port 27000


then I open my second shell to connect to mongo and I get the error message:

Error: couldn’t connect to server 127.0.0.1:27000 connection attempt failed: SocketException: Error connecting to 127.0.0.1:27000 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

Mongod did not start. shutting down with code:100 means mongod refuses to start. A few lines above the shutting down message you see Data directory /data/db not found. This means that mongod cannot find the directory /data/db. You have to create it.

2 Likes

Thank you steevej-1495
I have actually managed now to connect to the port 27000. I am using a Mac, so here are the steps I took to do Lab 1:

  1. vagrant up --provision (in the right directory m103-vagrant-env folder)
  2. vagrant status - confirmation step
  3. vagrant ssh
  4. new window on my terminal: mongod --port 27000

  1. new window on my terminal: mongo --port 27000
    the user had previously been created

  1. drop user and add it back because it seems incorrect

  1. go back to vagrant@m103:~$ validate_lab_launch_mongod and I get error message:

Problem solved, everything has to be within vagrant now I see