This topic describes how to troubleshoot failed instance connections caused by network environment.
Background information
For more information about how to troubleshoot other issues, refer to How do I troubleshoot failed connections to an ApsaraDB for MongoDB instance?
Internal network environment
Check regions
An Elastic Compute Service (ECS) instance and an ApsaraDB for MongoDB instance must be in the same region before the two instances can be connected over the internal network.
Check whether the two instances are deployed in the same region. The two instances can be in the same zone or different zones of a region.
If the two instances are in the same region, check the network types of the instances. If the two instances are in different regions, use the following solutions:
Method 1 (recommended): Migrate the ApsaraDB for MongoDB instance or the ECS instance to ensure that the two instances are in the same region. For more information, see Connect an ECS instance in a region to an ApsaraDB for MongoDB instance in another region over the internal network.
Method 2: Connect the virtual private clouds (VPCs) of the two instances by using a Cloud Enterprise Network (CEN) instance. This method requires that the two instances both use the VPC network type. For more information about how to create a CEN instance, see Use CEN to enable inter-region network communication.
Method 3: Connect the ECS instance to the ApsaraDB for MongoDB instance by using the public endpoint of the ApsaraDB for MongoDB instance. For more information about how to apply for a public endpoint for an ApsaraDB for MongoDB instance and connect an ECS instance to the ApsaraDB for MongoDB instance over the Internet, see Connect to an ApsaraDB for MongoDB instance over the Internet. This method has poor performance, security, and stability. The network stability is even worse when cross-border network is used.
Check network types
The two instances must use the same network type (VPC or classic network) or be on the same VPC before the two instances can be connected over the internal network.
VPCs are logically isolated from each other. Therefore, if the two instances both use the VPC network type, make sure that the two instances have the same VPC ID. This way, the two instances can be connected over the internal network.
Check whether the two instances use the same network type or are on the same VPC.
You can log on to the ECS console and view the network type and VPC ID of the ECS instance on the instance details page.
You can log on to the ApsaraDB for MongoDB console and view the network type and VPC ID of the ApsaraDB for MongoDB instance on the Basic Information page of the instance.
If the two instances use different network types or are on different VPCs, use the solutions described in the following table.
Scenario | Solution |
|
|
|
|
|
|
If the two instances use the same network type and be on the same VPC, troubleshoot other issues. For more information, see How do I troubleshoot failed connections to an ApsaraDB for MongoDB instance?
Check internal endpoints
You must use the correct internal endpoint to connect the ECS instance to the ApsaraDB for MongoDB instance over the internal network.
Check whether the internal endpoint of the ApsaraDB for MongoDB instance is correct.
You can log on to the ApsaraDB for MongoDB console and view the private IP address of the ApsaraDB for MongoDB instance on the Database Connections page of the instance.
Internet network environment
You must use the correct public endpoint to connect the ECS instance to the ApsaraDB for MongoDB instance over the Internet.
Check whether the public endpoint of the ApsaraDB for MongoDB instance is correct.
You can log on to the ApsaraDB for MongoDB console and view the public endpoint of the ApsaraDB for MongoDB instance on the Database Connections page of the instance.