This topic describes how to enable the direct connection mode for an ApsaraDB for Redis cluster instance by using a private endpoint. By default, cluster instances can be connected only through a proxy node. If you want to bypass proxy nodes and connect to ApsaraDB for Redis cluster instances in the same manner as you connect to native Redis clusters, you can enable the direct connection mode and apply for private endpoints for cluster instances. This reduces connection overheads and improves service performance.

Prerequisites

  • The instance is an ApsaraDB for Redis cluster instance.
  • The major version of the instance is Redis 4.0 (Community Edition) or Redis 5.0 (Community Edition or Enhanced Edition (Tair)).
  • The instance is deployed 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 Change the network type from classic network to VPC.
  • SSL encryption is disabled for the instance. For more information, see Configure SSL encryption.
  • The vSwitch to which the instance is connected has sufficient IP addresses that can be allocated. For more information, see Obtain the number of available IP addresses in the vSwitch to which an ApsaraDB for Redis instance is connected.
    Note For example, an ApsaraDB for Redis instance contains eight shards and you want to apply for a private endpoint for the instance. An IP address is allocated to the master node of each shard in the instance, 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 connection mode for the instance.

Comparison of connection modes

  • Proxy mode: Clients use the default proxy endpoint that is provided by an instance to send requests. Proxy nodes forward these requests to data nodes.
  • Direct connection mode: Clients can bypass proxy nodes and access backend data nodes by using a private endpoint. Compared with the proxy mode, the direct connection mode reduces the time consumed by proxy nodes and improves service performance.
Note Persistent memory-optimized instances of the cluster architecture do not support the proxy mode. By default, private endpoints are provided for these instances.

Precautions

  • Connectivity performance degrades because the proxy nodes are bypassed. For cluster instances of ApsaraDB for Redis 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 ApsaraDB for Redis Enhanced Edition (Tair), 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 a data skew or a specific shard receives a large amount of traffic whereas other shards stay idle, the connections to the shard may be exhausted and new connection requests may be rejected. In this case, the overall performance of the instance is affected.
    Note In most cases, data skew is caused by hotkeys or large keys. For more information about how to troubleshoot hotkeys and large keys, see Use the real-time key statistics feature and Offline key analysis.
  • If you cannot perform the following operations, you must first release the private endpoint. For more information, see Release a private endpoint for an ApsaraDB for Redis instance.

Procedure

  1. Log on to the ApsaraDB for Redis console and go to the Instances page. In the top navigation bar, select the region in which the instance is deployed. Then, find the instance and click the instance ID.
  2. In the Connection Type section, click Apply for Endpoint on the right side of Direct Connection.
  3. Optional: In the panel that appears, enter an endpoint and a port number.
    Parameter Description
    Endpoint
    • You can modify only the prefix of the endpoint. By default, the prefix is the instance ID.
    • The prefix must be 8 to 64 characters in length and can contain lowercase letters and digits. It must start with a lowercase letter.
    Port When you modify the endpoint, you can also modify the port number. Valid values for the port number: 1024 to 65535.
  4. Click OK.

FAQ

  • Q: My instance meets the requirements of the prerequisites. What do I do if I am unable to find Apply for Endpoint in the Actions column?

    A: You can update your instance to the latest minor version. For more information, see Update the minor version.

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

    A: No, the service is not interrupted when you enable the direct connection mode.

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

    A: Yes, you can connect to an ApsaraDB for Redis instance in direct connection mode when the proxy mode is enabled.

References