DocumentDB 4.0 vs mongo client

0

Hi all,

I launch a DocumentDB instance with 4.0 compatibility.

I try to connect from my EC2 Debian 10 with latest mongo client (mongodb 4.0 is not available for debian 10).

Connection seems ok but client is stuck after password. Not time out, connection is kept (seen in DocumentDB monitoring), but mongo shell is not available, unable to start mongo some query.

Does anyone succeed in accessing to DocumentDB from Debian 10 and mongo client ? (or using PHP since it will be my step after that).

已提问 3 年前444 查看次数
4 回答
0

Hi ,
I am able to connect to Amazon DocumentDB 4.0 from a Debain 10 EC2 instance and run queries in mongo shell. My Mongo shell version is 4.4.6. Do you see any error on the console ? Have you checked your security group configuration and ensured that security group assigned to DocumentDB has inbound rule that allows Debain 10 machine to communicate over port 27017 via TCP ? Which EC2 instance are you using ?

AWS
Karthik
已回答 3 年前
0

Thank you for feedback, so it is possible to do it ;)

Extract of my session:

$ mongo --host .amazonaws.com:27017 --username USERNAME
MongoDB shell version v4.4.5
Enter password:
connecting to: mongodb://
*.amazonaws.com:27017/?compressors=disabled&gssapiServiceName=mongodb
(
with --verbose activated }
{"t":{"$date":"2021-05-11T21:14:23.579Z"},"s":"D1", "c":"NETWORK", "id":20109, "ctx":"js","msg":"Creating new connection","attr":{"hostAndPort":"
.amazonaws.com:27017"}}
{"t":{"$date":"2021-05-11T21:14:23.601Z"},"s":"D1", "c":"NETWORK", "id":20119, "ctx":"js","msg":"Connected to host","attr":{"connString":"
**.amazonaws.com:27017"}}

No error shown and moreover is says "connected". But shell prompt is not displayed. So for me network stuff are ok. Will try to update to 4.4.6 mongo client.

已回答 3 年前
0

updated to mongo client 4.4.6, but same result.

"connected" message is not really "connected" because result is the same whatever password is given.

still searching...

已回答 3 年前
0

It is ok now, just refollow:
https://docs.aws.amazon.com/documentdb/latest/developerguide/connect-ec2.html
and create a specific Security Group for DocumentDB instance with just 27017 allowed from EC2 security group.

I tryed to share same security group and it seems no to be a good idea.

I was mistaken also by DocumentDB monitoring that count connection but may be it was more and outbound issue with DocumentDB security group. Incoming where ok, so monitoring count it and mongo client stucks, but outgoing was not ok and mongo shell stucks.

Now going to php hoping it will work directly ;)

已回答 3 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则