This topic describes how to connect to a cluster instance of ApsaraDB for Redis through a private endpoint. By default, cluster instances can be connected only through a proxy server. If you want to bypass the proxy server, you can enable the direct connect mode and apply for a private endpoint for a cluster instance. This reduces the number of connections and improves service performance.

Prerequisites

  • An ApsaraDB for Redis cluster instance is used.
  • The engine version of the cluster instance is Redis 4.0 (Community Edition) or Redis 5.0 (Community Edition and Enhanced Edition).
  • The instance runs in a virtual private cloud (VPC). If the instance is deployed in the classic network, you can change the network type to VPC. For more information, see Switch to VPC network.
  • Secure Sockets Layer (SSL) encryption of the instance is disabled for the instance. For more information, see Configure SSL encryption.
  • The vSwitch to which the instance belongs has IP addresses that can be allocated. For more information, see Obtain the number of available IP addresses in the vSwitch where an ApsaraDB for Redis instance is deployed.
    Note For example, the ApsaraDB for Redis instance contains eight shards, and you apply for a private endpoint. An IP address is allocated to the master node of each shard, and an additional IP address is allocated to the private endpoint. Therefore, the vSwitch must provide at least nine IP addresses. Otherwise, you cannot enable the direct connect mode.

Comparison of connection modes

  • Proxy mode: Proxy servers forward requests from clients to data nodes by using the default proxy endpoint that is provided by the instance.
  • Direct connect mode: Clients can access the backend data nodes by using the private endpoint. Compared with the proxy mode, the direct connect mode saves the time consumed by proxy servers and improves the service performance.

Precautions

  • The connectivity performance degrades because the proxy nodes are bypassed. For cluster instances of Community Edition, the maximum number of connections for a single shard is 10,000, and the number of new connections per second is 2,000. For cluster instances of Enhanced Edition, the maximum number of connections for a single shard is 30,000, and the number of new connections per second is 2,000. For more information, see Overview.
  • If data skews or a specific shard receives a large amount of traffic while other shards stay idle, the connections to the shard may be exhausted and new connection requests may be dropped. In this case, the overall performance of the ApsaraDB for Redis instance is affected.
    Note Data skew is caused by hotkeys and big keys. For more information about how to troubleshoot hotkeys and big keys, see View real-time hot key logs and Use the cache analytics feature to find big keys.
  • If you fail to perform the following operations, you must first release the private endpoint: For more information, see Release a private endpoint.

Procedure

  1. Log on to the ApsaraDB for Redis console.
  2. On the top of the page, select the region where the instance is deployed.
  3. On the Instance List page, click the Instance ID of the instance.
  4. In the left-side navigation pane, click Connection.
  5. In the Connection Type section, click Apply for Private Endpoint in the Actions column.
    Apply for a private endpoint
  6. In the dialog box that appears, set the parameters and click OK.
    Set the parameters for the private endpoint
    1. Optional:Modify the prefix of the private endpoint.
      An endpoint of ApsaraDB for Redis must be in the <prefix>.redis.rds.aliyuncs.com format. The prefix of the endpoint must be 8 to 64 characters in length and can contain lowercase letters and digits. It must start with a letter.
    2. Optional:Specify a port number.
      The port number must range from 1024 to 65535.
    3. Click OK.

FAQ

  • Q: My instance meets the requirements of the prerequisites. What can I do if I cannot see Apply for Private Endpoint in the Actions column?

    A: You can upgrade the minor version of your instance to the latest version. For more information, see Upgrade the minor version.

  • Q: Is the ApsaraDB for Redis service disrupted when I enable the direct connect mode?

    A: No. The service is not interrupted when you enable the direct connect mode.

  • Q: Can I connect to an ApsaraDB for Redis instance in direct connect mode when the proxy mode is enabled?

    A: Yes. You can connect to the ApsaraDB for Redis instance in direct connect mode when the proxy mode is enabled.