Tair (Redis OSS-compatible) instances are fully compatible with open-source Redis. You can connect to a Tair instance using any Redis-compliant client in the same way that you connect to a Redis database.
Prerequisites
Complete the following operations based on where your client is deployed.
Client deployment location | Operations to complete |
ECS instance (recommended) |
|
Local |
|
Notes
If your instance uses the cluster architecture or read/write splitting architecture, it provides a proxy node endpoint by default. You can connect to the instance in the same way that you connect to a standard-architecture instance.
NoteWhen you connect to a cluster instance using a direct connection endpoint, the connection method is the same as connecting to an open-source Redis cluster.
If password-free access over a VPC is enabled for the instance, clients in the same VPC can connect to the instance without a password.
Obtain connection information
When you use a client to connect to a Tair (or Redis Open-Source Edition) instance, you must obtain the following information and set it in your code.
Information to obtain | How to obtain |
Endpoint of the instance | Go to the Instances page, select a region in the top navigation bar, and then click the ID of the target instance. In the Connection Information section, you can view the endpoints and ports for different connection types. Note 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 | The default port is 6379. You can also customize the port. For more information, see Change an endpoint or port. |
Account of the instance (not required for some clients) | By default, an instance has an account named after the instance ID, such as r-bp10noxlhcoim2****. You can also create a new account and grant permissions to it. For more information, see Create and manage accounts. |
Password of the account | The password format varies based on the selected account:
Note
|
Common client examples
For a list of clients that Tair (and Redis Open-Source Edition) supports, see Redis Clients.
This section provides only sample code on how to use common clients to connect to Tair.