You can use a Redis client, Data Management (DMS), or the redis-cli tool to connect to an ApsaraDB for Redis instance.

Precautions

ApsaraDB for Redis can monitor the health status of nodes. If a master node in an instance becomes unavailable, ApsaraDB for Redis automatically triggers a master-replica switchover. The roles of master and replica nodes are switched over to ensure the high availability of the instance. Before a client is officially released, we recommend that you manually trigger the master-replica switchover. This can help you verify the error handling capabilities or disaster recovery logic of the client. For more information, see Manually switch workloads from a master node to a replica node.

Endpoint types

After an ApsaraDB for Redis instance is created, you can view the endpoint of the instance on the Instance Information page. By default, ApsaraDB for Redis provides an endpoint of the following network type:VPC or classic network. If you want to connect to the ApsaraDB for Redis instance by using a direct connection endpoint or a public endpoint, you must apply for the corresponding endpoint. For more information about endpoints, see View endpoints.

Figure 1. Endpoints
Endpoints
Note We recommend that you deploy your client on an ECS instance and use the client to connect the ECS instance to an ApsaraDB for Redis instance over a VPC. This way, you can improve security, reduce network latency, and avoid performance degradation caused by network latency. For more information, see What is ECS?

Common connection methods

Connection method Description
Use DMS You can use DMS to connect to ApsaraDB for Redis instances without the need to install a client. DMS allows you to manage ApsaraDB for Redis instances on a visual interface.
Use a Redis client ApsaraDB for Redis is compatible with open source Redis. You can connect to ApsaraDB for Redis and open source Redis in a similar manner. Therefore, you can use a client that is compatible with the Redis protocol to connect to ApsaraDB for Redis.
Note You can also enable the SSL encryption feature to enhance the security of data links and ensure data integrity. For more information, see Connect to an ApsaraDB for Redis instance that has SSL encryption enabled by using a client.
Use redis-cli The redis-cli tool is a CLI of open source Redis. You can use redis-cli to connect to an ApsaraDB for Redis instance from an ECS instance or your device. Then, you can manage data.

Special connection methods

Connection method Description
Use a public endpoint to connect to an ApsaraDB for Redis instance If you want to test or manage an ApsaraDB for Redis instance that is deployed on your device, you can apply for a public endpoint for the instance and connect to the instance over the public endpoint by using your device.
Use a private endpoint to connect to an ApsaraDB for Redis instance You can apply for a direct connection endpoint for a cluster master-replica instance. You can use the endpoint to connect to backend data shards in the instance in the similar manner as you would connect to an open source Redis cluster. For more information, see Cluster master-replica instances. Compared with the proxy mode , the direct connection mode reduces the response time of ApsaraDB for Redis because requests do not need to pass through proxy servers. For more information about how to enable the direct connection mode, see Enable the direct connection mode.
Use the Sentinel-compatible mode to connect to ApsaraDB for Redis instances ApsaraDB for Redis provides the Sentinel-compatible mode. If you enable this mode, clients can connect to ApsaraDB for Redis instances in the same way as they connect to native Redis Sentinel.

FAQ