Mongo Shell Fails to Connect to the DB Instance, Leaving Message "couldn't connect to server"
Symptom
An error is reported when you run the following command to connect to a DDS DB instance:
mongo --host 192.168.64.201 --port 8635 -u rwuser -p xxxxxxxxx --authenticationDatabase admin --ssl --sslCAFile /root/ca.crt --sslAllowInvalidHostnames
Error message:
MongoDB shell version v3.4.17 connecting to: mongodb://192.168.64.201:8635/ 2019-09-19T09:45:48.168+0800 W NETWORK [thread1] Failed to connect to 192.168.64.201:8635 after 5000ms milliseconds, giving up. 2019-09-19T09:45:48.168+0800 E QUERY [thread1] Error: couldn't connect to server 192.168.64.201:8635, connection attempt failed : connect@src/mongo/shell/mongo.js:240:13 @(connect):1:6 exception: connect failed
Possible Cause
The security group policy is not correctly configured. That means the security group rules do not allow the traffic into the DDS DB instance.
Solution
Set the security group policy. For details, see Setting a Security Group.
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.