This topic describes how to connect to a cluster instance of ApsaraDB for Redis through a direct connection. By default, cluster instances can only be connected 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

  • The 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 Enterprise Edition).
  • The instance runs in a Virtual Private Cloud (VPC) network.
  • SSL Certificate is disabled.
  • The number of available virtual IP addresses (VIPs) in the VPC network is greater than or equal to the number of data shards plus one.
    Note For example, if the cluster contains eight data shards, the VPC network must provide nine or more VIPs. Otherwise, direct connections cannot be enabled.

Background information

After you enable direct connection, you can connect to your cluster instance by using a private endpoint. To enable a direct connection, set the connection string on your client to the private endpoint of your cluster instance. Then, you can bypass the proxy server and access the data shards from your client. Compared with the proxy mode, the direct connection mode helps reduce the response time of ApsaraDB for Redis because requests do not need to pass through a proxy server.

Precautions

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

To perform these operations, you can Release private endpoints. After you complete these operations, you can apply for a private endpoint again.

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 Instance ID, or choose More > Manage in the Actions column.
  4. On the Instance Information page, click Connection in the left-side navigation pane.
  5. On the Connection page, click Apply for Private Endpoint in the Actions column of Direct Connection.
  6. In the Apply for Private Endpoint dialog box that appears, follow these steps:
    1. Modify the prefix of the private endpoint.
      An endpoint of ApsaraDB for Redis follows this format: <prefix>.redis.rds.aliyuncs.com. 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. Specify a port number.
      The port number must be 1024 to 65535.
    3. Click OK.

FAQ

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

    A: No. Enabling direct connection does not cause service disruption.

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

    A: Yes.

  • 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 one. For more information, see Upgrade the minor version.

What to do next