我不能连接我的亚马逊DocumentDB从我的亚马逊EC2 ubuntu机器?我已经检查了亚马逊DocumentDB的安全性,它目前被分配给默认的,它有“所有流量”。
我已经尝试了以下命令,直接从AWS实例页面中删除,尽管我收到了下面包含的错误消息。
我遵循了这个aws指南https://docs.aws.amazon.com/documentdb/latest/developerguide/getting-started.connect.html
来自 ubuntu机器的EC2 Mongo命令
mongo --ssl --host mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017 --sslCAFile rds-combined-ca-bundle.pem --username webuser --password mypassword
从ubuntu命令提示符中收到的错误消息如下
错误消息
MongoDB shell version v3.6.11
connecting to: mongodb://mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017/?gssapiServiceName=mongodb
2019-03-11T21:39:37.587+0000 W NETWOK [thread1] Failed to connect to 172.31.45.184:27017 after 5000ms milliseconds, giving up.
2019-03-11T21:39:37.595+0000 E QUERY [thread1] Error: couldn't connect to server mydatabasename.23scnncsd3.eu-west-1.docdb.amazonaws.com:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:263:13
@(connect):1:6
exception: connect failed
我做错了什么吗?任何帮助都很感激!
非常感谢,
更新
发布于 2019-04-14 14:03:30
亚马逊DocumentDB在VPC中部署集群,作为其他VPC和互联网的强大网络边界。当您连接到群集时,请确保客户端计算机与群集位于同一个区域和相同的VPC中。
或者,如果您的开发环境位于不同的Amazon中,您也可以使用VPC从同一区域或不同区域的另一个Amazon中查看并连接到Amazon集群。
有关疑难解答的更多信息:https://docs.aws.amazon.com/documentdb/latest/developerguide/troubleshooting.html
从VPC:https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-from-outside-a-vpc.html外部连接到Amazon集群
发布于 2022-11-08 11:47:09
也有同样的问题。对于EC2实例和DocumentDB实例,可用性区域/VPC/Security组是相同的,但仍然无法连接。
由于某些原因,美国文档缺少了CN文档中的一个步骤。us/documentdb/latest/developerguide/connect-ec2.html
您所需要做的就是向TCP和27017端口的和27017端口添加另一个入站规则。这对我有用。https://i.stack.imgur.com/lOqov.png
https://stackoverflow.com/questions/55110838
复制相似问题