This topic describes how to connect to a cluster instance of ApsaraDB for Redis through a direct connection. By default, cluster instances can be connected only through a proxy server. If you want to bypass the proxy server, you can apply for a private endpoint to enable direct connections to a cluster instance. This reduces the number of connections and improves service performance.
Prerequisites
- An ApsaraDB for Redis cluster instance is used.
- The engine version of the cluster instance is Redis 4.0 (Community Edition) or Redis 5.0 (Community Edition or Enterprise Edition).
- The instance runs in a Virtual Private Cloud (VPC) network. If the instance is deployed in the classic network, you can change the network type to VPC. For more information, see Switch to VPC network.
- Secure Sockets Layer (SSL) encryption of the instance is disabled. For more information, see Configure SSL encryption.
- 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.
Note For example, the instance contains eight data shards. When you apply for a private endpoint, an IP address is allocated to the primary node of each shard, and an extra IP address is allocated to the private endpoint. Therefore, the VSwitch must provide at least nine IP addresses. Otherwise, direct connections cannot be enabled.
Comparison of connection modes
- Proxy mode: Proxy servers forward requests from clients to data nodes by using the default proxy endpoint that is provided by the instance.
- Direct connection mode: Clients can access the backend data nodes by using the private endpoint instead of proxy servers. Compared with the proxy mode, the direct connection mode saves the time consumed by proxy servers and improves the service performance.
Precautions
If you enable direct connections, the following operations are not allowed:
To perform these operations, you can release private endpoints. For more information, see Release a private endpoint.
Procedure
FAQ
- My instance meets the requirements of the prerequisites. What can I do if I cannot
see Apply for Private Endpoint in the Actions column?
You can upgrade the minor version of your instance to the latest one. For more information, see Upgrade the minor version.
- Is the ApsaraDB for Redis service disrupted when I enable direct connection?
No. Enabling direct connection does not cause service disruption.
- Can I connect to an instance by using a direct connection when the proxy mode is enabled?
Yes, you can use a direct connection when the proxy mode is enabled.