All Products
Search
Document Center

ApsaraDB for Redis:Enable the direct connection mode

Last Updated:Jan 19, 2024

By default, ApsaraDB for Redis local disk-based cluster instances provide the proxy connection mode. If you want a local disk-based cluster instance to be compatible with the native Redis Cluster protocol, you can enable the direct access mode by following the instructions provided in this topic, and then connect to the obtained private endpoint on the client. You can use the endpoint to bypass proxy nodes and connect to the instance in the same manner as you connect to a native Redis cluster.

Prerequisites

The instance meets the following requirements:

  • The instance uses the cluster architecture.

  • The instance uses local disks.

  • TLS (SSL) encryption is disabled for the instance. For more information, see Enable TLS 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, your 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 ApsaraDB for Redis instance.

Comparison of connection modes

  • Direct connection mode: An instance for which the direct connection mode is enabled is allocated a private endpoint. Clients can use the endpoint to bypass proxy nodes and access backend data nodes in the instance. This reduces the response time of ApsaraDB for Redis.

  • Proxy mode: By default, ApsaraDB for Redis instances that have the proxy mode enabled are allocated proxy endpoints. Requests from clients are forwarded from proxy nodes to data nodes. For more information, see Features of proxy nodes.

Usage notes

  • Bypassing proxy nodes in a cluster instance and connecting directly to individual shards can result in decreased connection performance. For ApsaraDB for Redis Community Edition cluster instances, the maximum number of connections to a single shard is 10,000 and the number of new connections per second is 2,000. For ApsaraDB for Redis Enhanced Edition (Tair) cluster instances, the maximum number of connections to a single shard is 30,000 and the number of new connections per second is 2,000. For more information, see Overview.

  • Data skew may take place for ApsaraDB for Redis cluster instances. Data skew occurs when one shard in an instance receives a large number of requests while other shards in the instance remain idle. During data skew, the maximum number of connections to a shard may be reached and new connections to the shard 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 Use the offline key analysis feature.

  • After you enable the direct connection mode for an instance, you cannot upgrade the major version of the instance or change the zone to which the instance belongs. If you want to upgrade the major version or change the zone, release the private endpoint first. For more information, see Upgrade the major version, Migrate an instance across zones, and Release a private endpoint for a Tair instance.

  • If you want to change the configurations of an instance for which the direct connection mode is enabled, you can change only the number of shards or shard specifications at a time. For more information, see Why am I unable to change the configurations of a classic (local disk-based) cluster 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 that you want to manage resides. Then, find the instance and click the instance ID.

  2. In the Connection Information section, click Apply for Endpoint to the right of Private Endpoint.

  3. 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 40 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 this parameter: 1024 to 65535.

  4. Click OK.

    For information about how to use a private endpoint to connect to your ApsaraDB for Redis instance, see Use a private endpoint to connect to an ApsaraDB for Redis instance.

FAQ

  • My instance meets the requirements for enabling the direct connection mode. What do I do if I am unable to find Apply for Endpoint to the right of Private Endpoint?

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

  • Is the service interrupted when I enable the direct connection mode?

    No, the ApsaraDB for Redis service is not interrupted when you enable the direct connection mode.

  • Can I enable both the direct connection mode and the proxy mode for a Tair instance at the same time?

    If your instance is a local disk-based cluster instance, you can enable these two modes for the instance at the same time. If your instance is a cloud disk-based cluster instance, you can enable only a single mode for the instance.

Related API operations

API operation

Description

AllocateDirectConnection

Applies for a private endpoint for an ApsaraDB for Redis cluster instance.

ReleaseDirectConnection

Releases a private endpoint for an ApsaraDB for Redis cluster instance.

References