Help Center> Document Database Service> Troubleshooting> Connection Failure Message: network error while attempting to run command 'isMaster'
Updated on 2023-06-14 GMT+08:00

Connection Failure Message: network error while attempting to run command 'isMaster'

Symptom

An error is reported when you run the following command to connect to a DDS DB instance:

./mongo --host 192.168.168.182 --port 8635 -u rwuser -p xxxxxxxxxx --authenticationDatabase admin

Figure 1 Connection failed

Possible Cause

This preceding command is used to connect to a DB instance in non-SSL mode. If the SSL connection is enabled, an error is reported when you run this command.

Fault Locating

On the DDS console, click the instance name. On the Basic Information page, check whether SSL is enabled.

  • If SSL is enabled, connect to the instance in SSL mode using commands.

  • If SSL is enabled, connect to the instance over an unencrypted connection using commands.

Solution

Method 1: Run the following command disable SSL and use an unencrypted connection to connect to the instance:

./mongo --host 192.168.168.182 --port 8635 -u rwuser -p xxxxxxxxxx --authenticationDatabase admin

Method 2: Connect to the instance using SSL.

To connect to the instance using SSL, download the SSL certificate, upload the certificate to the ECS directory (for example, /root/ca.crt), and run the command in SSL mode to connect to the instance.

You can click the instance name on the DDS console, click next to SSL on the Connections page, and download the SSL certificate.

./mongo --host 192.168.168.182 --port 8635 -u rwuser -p xxxxxxxxxx --authenticationDatabase admin --ssl --sslCAFile /root/ca.crt --sslAllowInvalidHostnames

Figure 2 Connection succeeded