If you cannot connect to an ApsaraDB for Redis instance or have created an ApsaraDB for Redis instance, you can run the PING command to check the connection between an Elastic Compute Service (ECS) instance and the ApsaraDB for Redis instance.

Procedure

  1. Obtain the endpoint used to connect to the ApsaraDB for Redis instance. For more information, see View endpoints.
  2. Log on to the ECS instance in which your client is deployed and run the PING command in the CLI of the ECS instance.

    If the endpoint used to connect to the ApsaraDB for Redis instance is r-bp1zx****.redis.rds.aliyuncs.com, you can run the following PING command:

    ping r-bp1zx****.redis.rds.aliyuncs.com
    Note You can run this command in both Windows and Linux operating systems.
  3. View the test results.
    • In Windows, the system returns the test results after the PING command is run four times.
      Note To continuously check the connection, run the ping <host> -t command.
    • 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 in the following figure.
      Figure 1. Run the PING command on a Linux server
      Send PING messages from a Linux server to the ApsaraDB for Redis instance

Analyze the results

  • If all responses indicate successful connections, the connection is normal.
  • If no successful responses are returned, the connection is abnormal. The following items describe common causes:
    • The domain name fails to be resolved. For more information, see Troubleshoot connection issues caused by failed DNS resolution.
    • Abnormal behavior on the ECS instance triggers a security policy that disables ECS. Check the ECS instance 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 6379 of the ApsaraDB for Redis instance. For more information, see Add a security group rule.
    • Your client cannot connect to the ApsaraDB for Redis instance due to the network firewall settings of the client. Check the settings.