All Products
Search
Document Center

Tair (Redis® OSS-Compatible):How do I troubleshoot connection issues caused by failed DNS resolution?

Last Updated:Nov 04, 2024

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.

Causes

Various reasons may lead to connection issues between an ECS instance and a Tair instance. Failed DNS resolution is a common cause.

When the UnknownHostException or failed to connect: r-***************.redis.rds.aliyuncs.com could not be resolved error occurs, the hostname is unknown or the resolution of the endpoint fails. Check whether the domain name and DNS server settings are correct.

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.