Vagrant@m103 mongo connect failed

my vagrant up and connected to vagrant@m103:~$ mongo
MongoDB shell version v3.6.14
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-08-24T07:03:21.556+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-08-24T07:03:21.556+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

Hey @Venkata_Nagendra_45790

Do you have a running mongod? To check this run the following:

ps -ef | grep mongod

If you see the follow then you do not yet have a mongod process running and therefore will not be able to connect.

1 Like

Like natac13 wrote you may have a mongod already listening to port 27017. But it may also be any other server. You can run ss -tnlup to find out which ports are taken.

2 Likes