Error: couldn't connect to server localhost:30000, connection attempt failed: SocketException

I’ve written my Configuration File as below : ( configFile.yml ) . And I’ve corresponding folders as well in my IDE . And I’ve created my first user by taking admin database into account. ( user : raj , pwd : raj999 )

port: 30000
bindIp: localhost
dbPath: data/db
destination: file
path: logs/logFile.log
authorization: “enabled”

Now i run this following command in my terminal :
mongod -f configFile.yml

I can see mongod running as fork. And if i launch one more terminal with the following command i can view databases, collections.
mongo --host localhost:30000 --username raj --password --raj999

But If i launch this same command which is highlighted above in different machine (with mongoDB installed), im getting the error which is written in subject of this Topic.

Is your mongod up and running on port 30000 on other server?

To connect with mongo first your mongod should be up


Have you created the user?
You enabled authentication
Try to use authenticationDatabase

Any reasons why you are not using the IDE supplied in the course?

The error SocketException connection refused is most likely happen when mongod is not running at the given location.

Please provide screenshot of the command

ps -aef | grep [m]ongo

Now it is running. The output of

netstat -tlnp

is also of interest.

I have just notice that you have 2 browser tabs open on the goorm IDE. I suspect that you are running mongod on one and trying to connect with mongo on the other one. If like most browser IDE, your 2 tabs are different virtual machines isolated from each other.

You should try to connect with mongo on terminal2 where you ran the ps command. That is one of the external factor I wrote about. They introduced the IDE so that to make sure the people run the server and the client on the same machine so that firewall, vpn or things like that do not happen.

The clever thing to do would be strictly follows lab’s instructions.