All Products
Search
Document Center

ApsaraDB for MongoDB:How do I troubleshoot failed instance connections caused by network environment?

Last Updated:Jul 11, 2024

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:

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.

Note

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

    • ECS instance: VPC

    • ApsaraDB for MongoDB instance: classic network

    • Method 1 (recommended): Switch the network type of the ApsaraDB for MongoDB instance from classic network to VPC and make sure that the VPC ID of the ApsaraDB for MongoDB instance is the same as that of the ECS instance. For more information, see Switch the network type of an ApsaraDB for MongoDB instance from classic network to VPC.

    • Method 2: 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.

    • ECS instance: classic network

    • ApsaraDB for MongoDB instance: VPC

    • Method 1 (recommended): Switch the network type of the ECS instance to VPC and make sure that the VPC ID of the ECS instance is the same as that of the ApsaraDB for MongoDB instance. For more information, see Migrate ECS instances from a classic network to a VPC.

    • Method 2: 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.

    • ECS instance: VPC 1

    • ApsaraDB for MongoDB instance: VPC 2

    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.

    References