This topic describes how to connect to a cluster instance of ApsaraDB for Redis through a direct connection. By default, cluster instances can be connected only through a proxy server. If you want to bypass the proxy server, you can apply for a private endpoint to enable direct connections to 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 or Enterprise Edition).
  • The instance runs in a Virtual Private Cloud (VPC) network. 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 more information, see Configure SSL encryption.
  • The VSwitch to which the instance belongs has sufficient IP addresses that can be allocated. For more information, see Obtain the number of available IP addresses in the VSwitch.
    Note For example, the instance contains eight data shards. When you apply for a private endpoint, an IP address is allocated to the primary node of each shard, and an extra IP address is allocated to the private endpoint. Therefore, the VSwitch must provide at least nine IP addresses. Otherwise, direct connections cannot be enabled.

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 connection mode: Clients can access the backend data nodes by using the private endpoint instead of proxy servers. Compared with the proxy mode, the direct connection mode saves the time consumed by proxy servers and improves the service performance.

Precautions

If you enable direct connections, the following operations are not allowed:

To perform these operations, you can release private endpoints. For more information, see Release a private endpoint.

Note These operations will be supported in the direct connection mode of later versions.

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 Instances page, click the Instance ID of the instance.
  4. In the left-side navigation pane, click Connection.
  5. In the Connection Type section of the Connection page, click Apply for Private Endpoint in the Actions column of Direct Connection.
    Apply for a private endpoint
  6. In the dialog box that appears, specify the parameters and click OK.
    Specify 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 custom prefix of the endpoint must be 8 to 64 characters in length and can contain only lowercase letters and digits. It must start with a letter.
    2. Optional:Specify a port number.
      The port number must be from 1024 to 65535.
    3. Click OK.

FAQ

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

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

  • Is the ApsaraDB for Redis service disrupted when I enable direct connection?

    No. Enabling direct connection does not cause service disruption.

  • Can I connect to an instance by using a direct connection when the proxy mode is enabled?

    Yes, you can use a direct connection when the proxy mode is enabled.