All Products
Search
Document Center

ApsaraDB for MongoDB:The system prompts "connection attempt failed" when logging on to apsaradb for MongoDB through the Mongo Shell from a Linux instance

Last Updated:Dec 07, 2022

Problem description

When you log on to a MongoDB database from a Linux instance by using the Mongo Shell, the following error message is displayed.

MongoDB shell version: 3.2.3
DB Prefix:
connecting to: 10.X.X.8:3717/admin
2016-05-31T15:25:58.940+0800 W NETWORK  Failed to connect to 10. *. *.8:3717 after 5000 milliseconds, giving up.
2016-05-31T15:25:58.943+0800 E QUERY    Error: couldn't connect to server 10. *. *.8:3717 (10.X.X.8), connection attempt failed
    at connect (src/mongo/shell/mongo.js:181:14)
    at (connect):1:6 at src/mongo/shell/mongo.js:181
exception: connect failed

Cause

POSSIBLE CAUSES:

  • The Linux instance and the apsaradb for MongoDB instance do not belong to the same VPC.

  • The network types of the Linux instance and the apsaradb for MongoDB instance are different.

Solution

  1. Choose one of the following methods to fix the issue based on-site conditions:

  2. Log on to the Linux instance and run the following command to check whether the network connection between the Linux instance and the apsaradb for MongoDB instance is normal:

    telnet dds-ali12XXXXX.mongodb.rds.aliyuncs.com 3717
    Note

    Instructions the port of an apsaradb for MongoDB instance is 3717.

    A similar output is displayed. Confirm that the domain name is resolved and that Port 3717 can communicate properly. p34454.png

Documentation

Application scope

  • ApsaraDB for MongoDB