All Products
Search
Document Center

Tair (Redis® OSS-Compatible):Enable the direct connection mode

Last Updated:Nov 14, 2024

By default, Tair (Redis OSS-compatible) classic cluster instances provide the proxy connection mode. If you want a classic cluster instance to be compatible with the native Redis Cluster protocol, you can enable the direct connection 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 Tair (Redis OSS-compatible) cluster 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 is deployed in classic mode.

    Note

    By default, cloud-native cluster instances in direct connection mode are allocated private endpoints. You do not need to enable private endpoints for these instances. The direct connection mode is not supported for cloud-native cluster instances in proxy mode.

  • 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 Query the number of available IP addresses in the vSwitch to which an instance is connected.

    Note

    For example, an 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

  • 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 the service.

  • Proxy mode: By default, instances in proxy mode 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 Redis Open-Source 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 Tair (Enterprise Edition) 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 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 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 an 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 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 instance, see Use the direct connection mode to connect to a cluster 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 service is not interrupted when you enable the direct connection mode.

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

    If your instance is a classic cluster instance, you can enable these two modes for the instance at the same time. If your instance is a cloud-native 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 a cluster instance.

ReleaseDirectConnection

Releases the private endpoint of a cluster instance.

References