All Products
Search
Document Center

You cannot connect to an apsaradb for MongoDB instance by using a MongoDB client

Last Updated: Dec 21, 2020

Problem description

The system fails to connect to apsaradb for MongoDB through the DMS or Mongo Shell and the following error message is displayed.

  • InvalidInstanceId.NotFound:The instance not in current vpc RequestId:xxxxxxxxxxx.
  • Authentication failed: the username, password, or database name is incorrect.
  • The data management service (DMS) cannot connect to the apsaradb for MongoDB server. Check the connection addresses, network conditions, and whitelist settings before you try again.

Cause

The causes of this problem are as follows:

  • The IP address of the DMS instance is not in the whitelist of the instance.
  • IP address or network problem.
  • The username, password, or database name is invalid.

Solution

Select the following steps based on the on-site conditions.

Solution to a failure when you use DMS to log on to an apsaradb for MongoDB instance

  • Add the CIDR blocks of DTS servers to a whitelist of the destination instance. For more information, see set whitelists and security groups.
    Note: the CIDR block of DTS VPC is 100.104.0.0/16.
  • Check whether the MongoDB instance version and the network type are consistent with those of the DMS console.
  • Check whether the connection information is correctly configured. If not, modify the information.

Solution to a failure when you use the Mongo shell to log on to apsaradb for MongoDB instances

  • Check whether the regions and network types of the ECS and apsaradb for MongoDB instances meet the requirements for intranet logon.
    Note: If you want to access an apsaradb for MongoDB instance over the internal network of an ECS instance, the ECS instance and apsaradb for MongoDB instance must be in the same VPC and in the same region.
  • Check whether the connection information is correctly configured. If not, modify the information.
  • The internal IP address of the ECS instance is added to the whitelist of the apsaradb for MongoDB instance.
  • Run the ping and telnet commands on the ECS instance to check whether the connection succeeds. If not, check whether the ECS firewall and security groups have access restrictions.

References

Application scope

  • ApsaraDB for MongoDB