0
Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused  Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
    at connect (src/mongo/shell/mongo.js:179:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:179
tarzanbappa
  • 4,930
  • 22
  • 75
  • 117
abhishek
  • 11
  • 4

1 Answers1

0

The IP address (127.0.0.1) which you have given is pointing your localhost, ie., mongodb installed in your local machine.

Change that to EC2(mongo <public-dns-name>:27107/test) instance and it will work fine.

References:

How to connect to MongoDB EC2 instance

Community
  • 1
  • 1
Clement Amarnath
  • 5,301
  • 1
  • 21
  • 34
  • I have done this, but still not able to connect, in security group I set Inbound rule, my guess is firewall issue, becuase I am not able to see also port open 27017, if firewall is issue how to do this, please let me know the step, I am doing first time so I need to be carefull. Thanks – abhishek Jun 14 '16 at 07:12
  • ping the ec2 instance url from command prompt, and check whether if you are getting reply. If this ping is responding and you are still not able to connect from your application, log a ticket to your infrastructure or system maintenance team to enable access to the mongo urls – Clement Amarnath Jun 14 '16 at 07:35