If you cannot connect to a Redis instance, you can run the PING command to check the connection between an ECS instance and a Redis instance.
Procedure:
1. Obtain the connection address of the Redis instance. For more information, see Viewing Connection Addresses.
2. Log in to the ECS instance in which your client is deployed and run the PING command in the CLI of the ECS instance. If the connection address of the instance is 198.168.1.1, you can run the following PING command:
ping 198.20.4.16
3. Check the test results. In Windows, the system returns the test results after the PING command is run four times.
C:\Users\Administrator>ping 198.20.4.61
Ping 198.20.4.16198.20.4.61. 32 bytes of data:
Response from 198.20.4.61: Bytes=32 time=7ms TTL=52
Response from 198.20.4.61: Bytes=32 time=7ms TTL=52
Response from 198.20.4.61: Bytes=32 time=7ms TTL=52
Response from 198.20.4.61: Bytes=32 time=7ms TTL=52
198.20.4.61 ping statistics:
Data package: 4 transmitted, 4 received, 0 lost (0% package loss)
Estimated RTT in milliseconds:
min= 7ms, max = 7ms, average = 7ms
Description
To continuously check the connection, run the ping -t command.
4. The Linux system continuously sends ping messages while running the ping command. You can press CTRL and C on the keyboard to stop running the command and collect statistics, as shown as follows.
$ ping 198.20.4.61
PING 198.20.4.61 (198.20.4.61) 56(84) bytes of data.
64 bytes from 198.20.4.61: icmp_seq=1 ttl=64 time=0.515 ms
64 bytes from 198.20.4.61: icmp_seq=2 ttl=64 time=0.531 ms
64 bytes from 198.20.4.61: icmp_seq=3 ttl=64 time=0.345 ms
64 bytes from 198.20.4.61: icmp_seq=4 ttl=64 time=0.500 ms
64 bytes from 198.20.4.61: icmp_seq=5 ttl=64 time=0.435 ms
^C
--- 198.20.4.61 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3999ms
rtt min/avg/max/mdev = 0.345/0.465/0.531/0.069 ms
Analysis of Results:
If all responses indicate successful connections, the connection is normal.
If no successful responses are returned, the connection is abnormal. The following describes common causes:
l Abnormal behavior on the ECS instance triggers a security policy that disables ECS. Check the server and set precise outbound rules in a security group. For example, you can define that the ECS instance can only connect to the required IP address and port such as port 33016 of the Redis instance. For more information, see section 7.6.5. How Do I Configure a Security Group?
l Your client cannot connect to the Redis instance due to the network firewall settings of the client. Check the settings.
You can query the connection address and ID on the instance details page. For details, see Checking Connection Addresses.