This topic describes how to enable the direct connection mode for a cluster instance of ApsaraDB for Redis by using a direct connection endpoint. By default, cluster instances can be connected only through a proxy server. If you want to bypass proxy servers and connect to ApsaraDB for Redis cluster instances in the same way that you connect to native Redis clusters, you can enable the direct connection mode and apply for a direct connection endpoint. This reduces the connection overhead and improves service performance.
- The instance is an ApsaraDB for Redis cluster instance.
- The major version of the cluster instance is Redis 4.0 (Community Edition) or Redis 5.0 (Community Edition or Enhanced Edition).
- 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.
- Secure Sockets Layer (SSL) encryption is disabled for the instance. For more information, see Configure SSL encryption for an ApsaraDB for Redis instance.
- The vSwitch to which the instance belongs has sufficient IP addresses that can be
allocated. For more information, see Obtain the number of available IP addresses in the vSwitch where an ApsaraDB for Redis instance is deployed.
Note For example, an ApsaraDB for Redis instance contains eight shards, and you want to apply for a direct connection endpoint. An IP address is allocated to the master node of each shard, and an additional IP address is allocated to the direct connection endpoint. Therefore, the vSwitch must provide at least nine IP addresses. Otherwise, you cannot enable the direct connection mode.
Comparison of connection modes
- Proxy mode: Clients use the default proxy endpoint that is provided by an instance to send requests. Proxy servers forward these requests to data nodes.
- Direct connection mode: Clients can access the backend data nodes by using the direct connection endpoint. Compared with the proxy mode, the direct connection mode reduces the time consumed by proxy servers and improves the service performance.
- The connectivity performance degrades because the proxy servers 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 data skews 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 discarded. In this case, the overall performance of the ApsaraDB for Redis instance is affected.
- If you fail to perform the following operations, you must first release the direct connection endpoint. For more information, see Release a direction connection endpoint.
- Log on to the ApsaraDB for Redis console.
- In the top navigation bar of the page, select the region where the instance is deployed.
- On the Instances page, click the ID of the instance.
- In the Connection Type
section, click Apply for Endpoint on the right side of Direct Connection.
- 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 change the endpoint, you can also change the port number by entering a new port number from 1024 to 65535.
- In the message that appears, click OK.
- My instance meets the requirements of the prerequisites. What can I do if I am unable
to find Apply for Endpoint in the Actions column?
You can update your instance to the latest minor version. For more information, see Upgrade the minor version.
- Is the ApsaraDB for Redis service interrupted when I enable the direct connection
No, the service is not interrupted when you enable the direct connection mode.
- Can I connect to an ApsaraDB for Redis instance in direct connection mode when the
proxy mode is enabled?
Yes, you can connect to an ApsaraDB for Redis instance in direct connection mode when the proxy mode is enabled.