Troubleshoot connection issues caused by failed DNS resolution

Updated at: 2025-01-27 09:10

If the endpoint of a Tair or Redis Open-Source Edition instance fails to be resolved when you use the endpoint to connect to the instance from an Elastic Compute Service (ECS) instance. The ECS instance fails to connect to the Tair instance. This topic describes how to troubleshoot this issue.

Cause

Connection issues can occur between Elastic Compute Service (ECS) and Tair due to various reasons. When you encounter one of the following error messages, it indicates that the hostname or endpoint cannot be resolved correctly. Check the accuracy of the domain name and the DNS server settings.

  • Name or service not known

  • UnknownHostException

  • failed to connect: r-***************.redis.rds.aliyuncs.com could not be resolved

Procedure

In this example, the Linux operating system is used.

  1. Check whether the endpoint of the Tair instance in the service code is correct.

    Note

    You can view the endpoint of a Tair instance in the Endpoint section of the Instance Information page in the Tair console, as shown in the following figure.

    Figure 1. View endpoints查看连接地址

  2. Check whether the DNS server is correctly configured on the ECS instance. For more information, see What do I do if a Linux instance fails to resolve domain names?

  3. Optional: If the preceding procedure cannot resolve the issue, you can use the following temporary solution:

    Add the domain name and IP address of the Tair instance to the /etc/hosts file to ensure that the domain name can be resolved normally. For more information about other causes of connection issues, see How do I troubleshoot connection issues in Tair?

    Important

    You can edit the /etc/hosts file in a similar manner as you edit the resolv.conf file. The modification of the /etc/hosts file serves only as a temporary solution. If the IP address of the Tair instance changes, this solution becomes invalid.

  • On this page (1, T)
  • Cause
  • Procedure
Feedback
phone Contact Us