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: The number of concurrent write tasks. It is recommended to either leave it unset or set it to the number of CPU cores x 2.
-m: The source instance address, formatted as "password"@ip:port
; for passwordless authentication, use ip:port
.
-t: The target instance address, formatted as "password"@ip:port
; for passwordless authentication, use ip:port
.
--tmpfile=FILE: The temporary file name.
--tmpfile-size=SIZE: The maximum size of the temporary file.
--help: Views the help command.
Example
./redis-sync -m 127.0.0.1:6379 -t "xxx2018"@10.0.5.8:6379
Output Logs
[root@VM_5_16_centos bin]
この記事はお役に立ちましたか?