Help Center/ Document Database Service/ Troubleshooting/ Connection Failure Message: couldn't connect to server
Updated on 2022-09-21 GMT+08:00

Connection Failure Message: couldn't connect to server

Symptom

An error is reported when you run the following command to connect to a DDS 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, which means that the security group rules do not allow traffic to access the DDS instance.

Fault Locating

Check whether the security group policy of the DDS instance is correctly configured. If the security group policy settings are incorrect, you cannot access DDS from outside the security group.

Solution

Set the security group policy. For details, see Setting a Security Group.