Introduction
This topic describes how to use the telnet command to check the connectivity to the port of an apsaradb for Redis instance.
Background
You have installed the Telnet client for Linux or enabled the Telnet client for Windows on the ECS instance. A connection issue has occurred in the apsaradb for Redis service. When the connection is established, you can run the ping command to check the connection between the ECS instance and apsaradb for Redis instance. In this case, you must use the telnet command to check whether the service port is available.
- See view connection address to view the connection address of the Redis instance.
- Log on to the ECS instance and run the following command in the command-line interface (CLI):
telnet [$Host] 6379
Note:
Run the telnet command in the Linux as shown in the following figure.
- [$Host] indicates the connection address of the apsaradb for Redis instance.
- The default port number for apsaradb for Redis is 6379. The port number depends on the actual port number.
- You can run this command in both Windows and Linux operating systems.
The following figure shows how to run the telnet command in Windows. - Check the test result. The following examples show the results of running the command in Linux and Windows.
- Linux the telnet-based connection is successful.
Windows system telnet connection success display interface. - Linux the telnet-based connection is successful.
Windows system telnet connection success display interface.
- Linux the telnet-based connection is successful.
Result analysis
- If a connection issue occurs in the ApsaraDB for Redis service, but the ECS instance can reach the ApsaraDB for Redis instance by using a telnet command, the ECS instance is normally connected to the ApsaraDB for Redis instance. You need to check other causes, such as clients, service code, and Redis service blocking due to service environment. For more information, see Redis connection troubleshooting.
- If the telnet-based connection fails, but the ECS instance can reach the apsaradb for Redis instance by using ping messages, the ECS instance may have abnormal behavior. For example, the ECS instance attacks Port 6379 of the apsaradb for Redis instance due to malicious programs. In this case, some services may have been disabled. In this case, we recommend that you monitor the ECS data to identify and handle abnormal traffic, or submit a ticket to Alibaba Cloud engineers.
- If the telnet-based connection fails and a "Name or service not known" error is returned, the connection address may be incorrect or the domain Name system (DNS) resolution has an exception. Make sure the connection address is correct. If the connection fails, see solve connection issues caused by failed DNS resolution.
- If the telnet-based connection fails and the ECS instance cannot reach the apsaradb for Redis instance by using ping messages, troubleshoot connection issues in the apsaradb for Redis instance. For more information, see.
Application scope
- ApsaraDB for Redis