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.
NoteThe 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.
NoteIf 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
Replica cluster
Sharded cluster
Application scope
ApsaraDB for MongoDB