Learn how to enable and release direct connection endpoints for classic cluster instances, and understand the limitations of direct connection mode.
Prerequisites
Before you begin, make sure your instance meets all of the following requirements.
-
Use the cluster architecture with Deployment Mode set to Classic
For a cloud-native cluster instance already in direct connection mode, a direct connection endpoint is provided by default and does not need to be enabled. Cloud-native cluster architecture in proxy mode does not support enabling direct connection mode.
To enable direct connection, also ensure:
-
The instance is compatible with Redis 5.0 and updated to the latest minor version
-
Transport Layer Security (TLS) is disabled — see TLS encryption
-
The vSwitch has enough available IP addresses: direct connection allocates one IP address to the primary node of each shard, plus one for the endpoint itself. For an 8-shard instance, the vSwitch needs at least 9 available IP addresses. To check, see Query the number of available IP addresses for the vSwitch of an instance
To release the private endpoint, also ensure:
-
Direct connection mode is already enabled on the instance.
-
Your application has been updated to use a different endpoint, such as the internal endpoint in proxy mode. See View endpoints
After the private endpoint is released, clients using that endpoint can no longer connect to the instance. Update your application's connection configuration before you proceed.
Limitations
-
Reduced per-shard connections: Because the proxy is bypassed, the maximum number of connections per shard drops to 10,000 (Redis Open-Source Edition cluster) or 30,000 (Tair (Enterprise Edition) cluster). If data skew occurs — where one shard is heavily accessed while others are mostly idle — connections to that shard may be exhausted, causing new connection requests to fail. To diagnose data skew caused by hot spot keys or large keys, see Top Key statistics and Offline full key analysis.
-
Major version upgrades and zone changes blocked: After enabling direct connection mode, you cannot upgrade the major version or change the zone of the instance. Release the private endpoint first, then perform the upgrade or zone change. See Upgrade the major version and Migrate an instance across zones.
-
Configuration changes limited: When changing the configuration of an instance with direct connection enabled, change only the number of shards or shard specifications, and only one at a time. See Why am I unable to change the configurations of a classic (local disk-based) cluster instance?
Enable direct connection
By default, a Tair (Redis OSS-compatible) instance using the classic cluster architecture connects through a database proxy endpoint. To make the instance compatible with the native Redis Cluster protocol, enable direct connection mode and use the direct connection endpoint from your client. This lets your client bypass the proxy node and access backend data nodes directly, reducing latency by eliminating proxy request processing.
Connection modes
| Mode | How it works | Trade-offs |
|---|---|---|
| Direct connection | The client bypasses the proxy and connects directly to backend data nodes. | Lower latency. Maximum connections per shard are reduced: 10,000 for Redis Open-Source Edition, 30,000 for Tair (Enterprise Edition). |
| Proxy mode | Client requests are forwarded by the proxy node to data nodes. See Tair Proxy features. | Higher connection limits. Small processing overhead per request. |
Enable direct connection
Enabling direct connection does not interrupt your service.
-
Log on to the console and go to the Instances page. In the top navigation bar, select the region of the instance. Find the instance and click its ID.
-
In the Connection Information area, click Request to the right of Direct Connection.
-
In the panel that appears, configure the endpoint and port.
Configuration Description Endpoint Currently, only the prefix of the connection address can be modified. The prefix defaults to the instance ID followed by pi(for example,{InstanceId}pi). The custom prefix must meet the following requirements: starts with a lowercase letter, ends with a lowercase letter or digit, contains only lowercase letters, digits, and hyphens (-), and is 8 to 66 characters in length.Port Number Must be between 1024 and 65535. You can change the port number when you modify the endpoint. -
Click OK.
For a connection example, see Connect to an instance in direct connection mode.
Release a private endpoint
Release the private endpoint of an ApsaraDB for Redis instance to disable direct connection mode. This is required before certain operations that direct connection mode does not support, such as changing instance configurations or upgrading a major version.
Release the private endpoint
-
Log on to the console and go to the Instances page. In the top navigation bar, select the region where the instance resides, and then click the instance ID.
-
In the Connection Information section, click Release Connection Address to the right of Private Endpoint (Host).
-
In the panel that appears, click OK.
FAQ
I meet all the prerequisites, but I cannot find the Apply for Endpoint button. What should I do?
Update the instance to the latest minor version. See Update the minor version and proxy version.
Can I use the direct connection endpoint and the proxy endpoint at the same time?
For a classic cluster architecture, yes — both modes can be active simultaneously. For a cloud-native cluster architecture, only one mode can be active at a time.
API reference
| API operation | Description |
|---|---|
| AllocateDirectConnection | Request a direct connection endpoint for a cluster instance. |
| ReleaseDirectConnection | Release the direct connection endpoint of a cluster instance. |