0

I am unable to connect to remote MongoDB from my local Machine. Getting the below exceptions while trying to connect using Mongo shell.

Request from shell:

mongo --username[username] --password[password]--host [Public DNS] --port 27017

Response: Failed to connect to :27017, reason: errno:61 Connection refused 2015-12-03T16:31:51.514-0500 E QUERY Error: couldn't connect to server , connection attempt failed at connect (src/mongo/shell/mongo.js:181:14) at (connect):1:6 at src/mongo/shell/mongo.js:181

I have followed the below template to configure the server on the Amazon cloud. https://s3.amazonaws.com/quickstart-reference/mongodb/latest/doc/MongoDB_on_the_AWS_Cloud.pdf

Can anyone help me to resolve this issue.

Thank you in advance.

Santosh
  • 13
  • 1
  • 6
  • 1
    Does the security group attached to the MongoDB server have port 27017 open for the IP address you are trying to connect from? – Mark B Dec 03 '15 at 21:43
  • @mbaird Yes. I have opened this port in the security group. – Santosh Dec 03 '15 at 21:48
  • netstat -a gives the following result on Mongodb server 'tcp 0 0 *:51335 *:* LISTEN tcp 0 0 *:27017 *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN ' – Santosh Dec 03 '15 at 21:55
  • Is your `bind_ip` setting in /etc/mongod.conf uncommented? Try looking at this: http://stackoverflow.com/questions/14653938/remotely-connecting-to-mongodb-http-interface-on-ec2-server – Mark B Dec 03 '15 at 21:57
  • mbaird, Yup, it 's uncommented and I have tried changing the bind_ip with different options. like port = 27017 bind_ip = 127.0.0.1,[Mongo_node_Private_ip],[Public_ip] – Santosh Dec 03 '15 at 22:08
  • You need to comment it out – Mark B Dec 03 '15 at 22:08
  • Read all the answers in the post I linked. – Mark B Dec 03 '15 at 22:08
  • @mbaird,I have modified the /etc/monogod.conf file and restarted the mongod server.But It is still showing the same error when I am trying to connect from client Mongo shell. – Santosh Dec 03 '15 at 22:28

0 Answers0