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.
Check whether the endpoint of the Tair instance in the service code is correct.
NoteYou 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
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?
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?ImportantYou can edit the
/etc/hosts
file in a similar manner as you edit theresolv.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.