Tair (Redis OSS-compatible) instances are fully compatible with open source Redis. You can connect to Tair instances in the same manner as you connect to Redis databases. Therefore, you can use any Redis-compliant client to connect to a Tair instance.
Prerequisites
The operations listed in the following table are performed based on the type of the host on which the client is deployed.
Host | Operation |
ECS instance (recommended) |
|
On-premises device |
|
Usage notes
By default, cluster and read/write splitting instances run in proxy mode. In this mode, you can connect to such an instance by using the endpoint of a proxy node in the instance in the same manner as you connect to a standard instance. For more information about cluster and read/write splitting instances, see Cluster master-replica instances and Read/write splitting instances.
NoteIf you use a private endpoint to connect to a cluster instance, you can connect to the instance in the same manner as you connect to an open source Redis cluster. For more information about private endpoints, see Enable the direct connection mode.
If password-free access is enabled for a Tair instance deployed in a VPC, clients that are located in the same VPC as the instance can connect to the instance without using passwords. For more information, see Enable password-free access.
Obtain connection information
When you use a client to connect to a Tair or Redis Open-Source Edition instance, you must obtain the connection information described in the following table and specify the information in the code.
Item | Description |
Instance endpoint | Tair instances support multiple endpoint types. We recommend that you use VPC endpoints for higher security and lower network latency. For more information, see View endpoints. |
Port number | Use the default port number 6379 or specify a custom port number. For more information, see Change the endpoint or port number of an instance. |
Instance account (optional for specific clients) | By default, a Tair instance has a database account that is named after the instance ID. Example: r-bp10noxlhcoim2****. You can create another database account and grant the required permissions to the account. For more information, see Create and manage database accounts. |
Password | The password format varies based on the selected account:
Note
|
Common types of clients
For a list of the clients supported by Tair and Redis Open-Source Edition, see Redis Clients.
This section provides only sample code on how to use common clients to connect to Tair.