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
Database Audit
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

Migrating with Redis-Port

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-03-18 10:07:15

Introduction of Tools

redis-port (Linux 64-bit) is an open-source toolset mainly used for database synchronization, data import, and data export among Redis nodes. It supports cross-version data migration for Redis. The toolset includes the following tools:
redis-sync:Supports data migration among Redis instances.
redis-restore:Allows importing Redis backup files (RDB) into the specified Redis instance.
redis-dump:Allows backing up Redis data into RDB format files.
redis-decode:Allows parsing Redis backup files (RDB) into readable files.

Compatible Versions

Supports the source Redis 2.8, 3.0, and 4.0.
Supports target instances for the Redis 2.8, 3.0, 3.2, and 4.0, as well as all editions of TencentDB, including Redis Memory Edition and CKV Edition.

redis-sync Online Migration

Migration Principle

The redis-sync tool is divided into two main modules. It simulates a binary replica node continuously synchronizing data from the source instance and translating the replicated data into write commands to update the target instance.
The data replication process consists of two phases: the full synchronization phase and the incremental synchronization phase.
Note:
The number of databases (DB) in the target instance should be greater than that in the source instance; otherwise, the migration will fail.
If the migration is interrupted due to network issues or other reasons, the target instance should be cleared before restarting the migration, otherwise, dirty data may appear.
Migration progress. When the log displays sync: rdb = 9063349 - [100.00%], it indicates that the full data synchronization is completed, and the tool is now performing incremental data synchronization. When speed=(0/0,0/0,0) appears, it indicates that the incremental data synchronization is completed.
To stop the migration, you can terminate the tool by pressing Ctrl+C or using another method to stop the tool's execution, which will stop the data synchronization process.

Parameter Description

-n: number of concurrent write tasks. It is recommended to leave it empty or set it to the value calculated by using the formula: Number of CPU cores x 2.
-m:The source instance address, formatted as "password"@ip:port; for passwordless authentication, useip:port.
-t:The target instance address, formatted as"password"@ip:port; for passwordless authentication, useip:port.
--tmpfile=FILE:The temporary file name.
--tmpfile-size=SIZE:The maximum size of the temporary file.
--help: help command.

Use Case

./redis-sync -m 127.0.0.1:6379 -t "xxx2018"@10.0.5.8:6379

Output Log

[root@VM_5_16_centos bin]# ./redis-sync -m 127.0.0.1:6379 -t "xxx2018"@10.0.5.8:6379
2019/02/21 09:56:00 sync.go:76: [INFO] sync: master = "127.0.0.1:6379", target = "xxx2018@10.0.5.8:6379"
2019/02/21 09:56:01 sync.go:103: [INFO] +
2019/02/21 09:56:01 sync.go:109: [INFO] sync: runid = "f63e2ad58e2fcc15c8cc122f15778389a012c1a4", offset = 18576271
2019/02/21 09:56:01 sync.go:110: [INFO] sync: rdb file = 9063349 (8.64mb)
2019/02/21 09:56:01 sync.go:208: [INFO] sync: (r/f,s/f,s) = (read,rdb.forward,rdb.skip/rdb.forward,rdb.skip)
2019/02/21 09:56:02 sync.go:250: [INFO] sync: rdb = 9063349 - [100.00%] (r/f,s/f,s)=(1703936/71754,0/0,0) ~ (1.62mb/-,-/-,-) ~ speed=(1.62mb/71754,0/0,0)
2019/02/21 09:56:03 sync.go:250: [INFO] sync: rdb = 9063349 - [100.00%] (r/f,s/f,s)=(3407872/153850,0/0,0) ~ (3.25mb/-,-/-,-) ~ speed=(1.62mb/82096,0/0,0)
2019/02/21 09:57:54 sync.go:250: [INFO] sync: rdb = 9063349 - [100.00%] (r/f,s/f,s)=(80487526/411969,0/1587212,0) ~ (76.76mb/-,-/-,-) ~ speed=(0/0,0/0,0)

Data Import by Using redis-restore

The redis-restore tool supports importing Redis backup files (RDB) into specified instances, and also supports importing AOF files. It is compatible with RDB file formats from Redis versions 2.8, 3.0, 3.2, and 4.0.

Parameter Description:

-n: number of concurrent write tasks. It is recommended to leave it empty or set it to the value calculated by using the formula: Number of CPU cores x 2.
-i: RDB file path.
-m: address of the target instance. The format is "password"@ip:port. For password-free authentication, the format is ip:port.
-a: AOF file path.
--db=DB: database ID of the target Redis instance for backup file import, which should be the same as that of the source instance.
--unixtime-in-milliseconds=EXPR: the key expiration time updated during data import.
--help: help command.

Use Case

./redis-restore dump.rdb -t 127.0.0.1:6379

Data Backup by Using redis-dump

redis-dump supports backing up data into RDB files while also supporting the backup of AOF incremental data.
Note:
Tencent Cloud Distributed Cache currently does not support backups using the redis-dump tool. You can perform data backups and downloads via the Distributed Cache console or APIs, while using the redis-dump tool to back up your self-built Redis instances.

Parameter Description:

-n: number of concurrent write tasks. It is recommended to leave it empty or set it to the value calculated by using the formula: Number of CPU cores x 2.
-m: Redis instance address, in the format of "password"@ip:port , the format for password-free authentication is ip:port .
-o: path of the output RDB file for backup.
-a: path of the output AOF file for backup.
--help: help command.

Use Case

./redis-dump 127.0.0.1:6379 -o dump.rdb

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백