简体   繁体   English

从mongo shell连接到MongoDB部署时,连接尝试失败

[英]Connection attempt failed when connecting to MongoDB deployment from mongo shell

first question and complete beginner so apologies in advanced for any silly mistakes. 第一个问题和完整的初学者,对于任何愚蠢的错误,我们深表歉意。

I have created a server on Amazon Web Services and then linked that through the MongoDB Cloud Manager where I made a replica set. 我已经在Amazon Web Services上创建了一个服务器,然后通过MongoDB Cloud Manager链接了该服务器,并在其中创建了一个副本集。

I have been following the tutorial on the mongoDB cloud documentation but have become stuck on the final part - "Connect to a MongoDB Process". 我一直在关注mongoDB云文档上的教程,但是最后一部分卡住了“连接到MongoDB进程”。

It says "Cloud Manager provides a mongo shell command that you can use to connect to the MongoDB process if you are connecting from the system where the deployment runs" - Can I not do this because the deployment is running on the Amazon Server? 它说:“ Cloud Manager提供了mongo shell命令,如果您要从运行部署的系统进行连接,则可以使用该命令连接到MongoDB进程”-我不能这样做,因为部署是在Amazon Server上运行的?

When I enter the mongo shell command this is what it reads: 当我输入mongo shell命令时,它显示为:

MongoDB shell version: 3.0.4
connecting to: AM-0.amigodb.0813.mongodbdns.com:27001/AmigoMain_1
2015-08-07T18:41:56.806+0100 W NETWORK  
Failed to connect to 52.18.23.14:27001 after 5000 milliseconds, giving up.
2015-08-07T18:41:56.809+0100 E QUERY    
Error: couldn't connect to server AM-0.amigodb.0813.mongodbdns.com:27001       (52.18.23.14), connection attempt failed
at connect (src/mongo/shell/mongo.js:181:14)
at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

I followed the instructions for the security settings on the Amazon Web Service but thinking that I may well have made a mistake. 我按照Amazon Web Service上有关安全性设置的说明进行操作,但认为我很可能犯了一个错误。

Would greatly appreciate any help or where to go for answers. 将不胜感激任何帮助或在哪里可以找到答案。

Thanks, 谢谢,

Louis 路易

Mongo by default only listens to connections on localhost. 默认情况下,Mongo仅侦听localhost上的连接。 You'll need to edit mongo.conf and add your IP to the "bind ip" setting. 您需要编辑mongo.conf并将IP添加到“ bind ip”设置。

This is my mongod.conf file: 这是我的mongod.conf文件:

processManagement:
   fork: true
net:
   bindIp: 127.0.0.1
   port: 27017
storage:
   dbPath: "/data/db"
systemLog:
   destination: file
   path: "/var/log/mongod.log"
   logAppend: true
storage:
   journal:
        enabled: true

It also gave me the same error message when I changed my bindIp to 0.0.0.0 当我将bindIp更改为0.0.0.0时,它也给了我同样的错误消息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM