tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

Release Notes and Announcements
Release Notes
Announcements
User Tutorial
Product Introduction
Overview
Product Strengths
Use Cases
Storage Engine
Product Series
Product Versions
Specifications and Performance
Read/Write Separation
Multi-AZ Deployment
Regions and AZs
Terms
Service Regions and Service Providers
Purchase Guide
Billing Overview
Pricing Center
Instance Purchasing
Renewal (Yearly/Monthly Subscription)
Refund (Yearly/Monthly Subscription)
Overdue Payments
Switching from Pay-as-You-Go to Yearly/Monthly Subscription
Getting Started
Quickly Creating an Instance
Connecting to Redis Instance
Operation Guide
Operation Overview
Connecting to a Database Instance
Managing Instances
Upgrade Instance
Management Node (Redis/ValKey Edition)
Multi-AZ Deployment Management
Backup and Restoration
Managing Accounts
Parameter Configuration
Slow Query
Access Management
Network and Security
Monitoring and Alarms
Event Management (Redis/ValKey Edition)
Data Migration
Global Replication for Redis Edition
Performance Optimization
Sentinel Mode
Development Guidelines
Naming Rules
Basic Usage Guidelines
Design Principles of Key and Value
Command Usage Guidelines
Design Principles of Client Programs
Connection Pool Configuration
Command Reference
Command Reference Overview
Redis Edition and Valkey Edition Command Compatibility
Version Command Usage Differences
Differences Between the Proxy Architecture and Direct Connection Mode
More Command Operations (Redis/Valkey Edition)
Memcached Edition Command Compatibility
Practical Tutorial
Building TencentDB for Redis® Client Monitoring Based on Spring Boot
Redis Client Connection Configuration Policy and Practice
Global SCAN Guide for Cluster Architecture
Eliminating Instances Securely
Hot Key and Big Key
AZ Migration Scheme
Troubleshooting
Connection Exception
Exception Analysis and Solution of Redisson Client Timeout Reconnection
Performance Troubleshooting and Fine-Tuning
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Parameter Management APIs
Other APIs
Backup and Restoration APIs
Region APIs
Monitoring and Management APIs
Log APIs
Data Types
Error Codes
FAQs
General
Connection and Login
Purchase
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

Connecting to Redis Instance

PDF
Focus Mode
Font Size
Last updated: 2026-03-17 16:36:36

Overview

Once the instance is created and its status becomes Running, you can connect to the database to perform read/write and query operations. This document describes three methods to connect to the database.
Connection via client: You can connect to a TencentDB instance at its automatically assigned private address from a Windows or Linux CVM instance based on the client. This connection method utilizes the high-speed private network of Tencent Cloud and features low delay. Both instances should be under the same account and reside in the same VPC in the same region or reside in the classic network.
Note:
CVM and TencentDB instances in different VPCs (under the same or different accounts in the same or different regions) can be interconnected over the private network through Cloud Connect Network.
Tencent Cloud Lighthouse and Cloud Database do not communicate via the private network by default. To enable private network access, see Lighthouse Application for Cloud Connect Network Association.
CVM and TencentDB instances in different VPCs can be connected through the public network address as instructed in Configuring Public Network Address.
Connection via DMC: You can use Tencent Cloud Database Management Center (DMC) to log in to your TencentDB instance to access them, view their key metric information, and run Redis commands.
Connection via SDK: You can connect to a Tencent Cloud Distributed Cache instance by configuring auto-assigned private IP address, port, instance ID, and password in the SDK for the corresponding programming language. Then, you can manipulate it, get and set its key, and do more.

Prerequisites

Prepare a Tencent Cloud Distributed Cache instance. For more information, see Creating Tencent Cloud Distributed Cache Instance.
Prepare a database account and password. For more information, see Managing Account. You can use the default account or a custom account.
Configure security group rules for the CVM instance and the Tencent Cloud Distributed Cache instance. For more information, see Configuring Security Group.
Obtain the Private IPv4 Address for database connection in the Network Info section on the Instance Details page in the Tencent Cloud Distributed Cache console.

Connecting by Using Client Tool

Note:
The Redis 6.2 version does not support the RESP3 protocol.

Connecting from a Linux CVM instance

Step 1. Prepare the environment

1. Log in to the Linux CVM instance. For more information, see Customizing Linux CVM Configurations.
2. Take a CVM instance running CentOS as an example. Run the following command to install the Redis protocol client:
yum install redis -y
If Complete! is displayed, the client is installed successfully.

Step 2. Connect to an instance

Passwordless authentication If your instance is password-free, the connection command is as follows:
redis-cli -h IP address -p port
Here, the IP address and port are the Private IPv4 Address and Port obtained in the Network Info section on the Instance Details page in the Tencent Cloud Distributed Cache console.

Access with default account
The default account refers to the account assigned by the system by default. When you purchase and create a Tencent Cloud Distributed Cache instance, the password you set to access the instance is the database password corresponding to the default account. To use the default account with a password to access the database, the following open-source connection command is supported:
redis-cli -h IP address -p port -a password
Here, the IP address and port are the Private IPv4 Address and Port obtained in the Network Info section on the Instance Details page in the Tencent Cloud Distributed Cache console. For example, if the password you set is abcd1234, the connection command should be as follows:
redis-cli -h IP address -p port -a abcd1234
Note:
To access instances purchased before January 2018, you need to replace the "password" with "instance ID:password", for example, redis-cli -h IP address -p port -a crs-bkuza6i3:abcd1234.
Access with custom account If you use a custom account as described in Managing Account when connecting, then the authentication method of the custom account is account name@password, which acts as the password parameter for accessing Tencent Cloud Distributed Cache:
redis-cli -h IP address -p port -a account name@password

Connecting from a Windows CVM instance

1. Configure and log in to the Windows CVM instance. For more information, see Customizing Windows CVM Configurations.
2. In the Windows CVM instance, download the Tencent Cloud Distributed Cacheclient over the internet and install it.
3. Open the Redis client, configure the instance's private IP address, and click Test Connection to connect to the instance.
Parameter
Description
Name
The name of the connection to the database instance.
Address
Enter the private IPv4 address of the database instance, which can be obtained in the Network Info section on the Instance Details page in the console.
Verification
Enter the password for database instance connection.

4. Click

and enter a Redis command in the input box in the bottom-right corner to run it.

Connection via DMC

Note:
Memcached instances do not currently support DMC connections.
2. Above the instance list, select the region.
3. In the instance list, find the target instance.
4. Click Log In in the Operation column.
5. You will be redirected to the login page of DMC. Enter the default account password of the target instance and click Log In.

6. You can view the instance monitoring information on the Instance Info tab on the Database Management page.


7. Click the Command Line tab and enter a Redis command in the input box at the bottom to run it:

8. If you are unfamiliar with Redis command parameters, you can select the slot range and database for storing key values in the Object List section on the left of the page, click Create, select the key data type, click OK, edit the key name in the Key Name input box, and click Add element and create key. Then, enter the corresponding key value and click OK in the Add Element window. The system will run commands based on the set key and key value.


Connection via SDK

Tencent Cloud Distributed Cache can be accessed via SDKs for various programming languages, including PHP, Java, Node.js, Python, C, Go, and .NET. For specific samples, see PHP Connection Sample. You can download an SDK client and then connect to a Tencent Cloud Distributed Cacheinstance by configuring its private IP, port, instance ID, and password as instructed in the sample code.

FAQs

If the connection failed, see Distributed Cache Instance Connection Failure for troubleshooting one by one.
For more FAQs, see Connection and Login.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback