The Standalone Edition can be your self-created Redis Standalone Edition or TencentDB for Redis Standard Edition. This document describes the compatibility issues in migrating data from Redis Standalone Edition to TencentDB for Redis Cluster Edition.
TencentDB for Redis Cluster Edition adopts the cluster architecture consisting of Tencent Cloud's proprietary proxy and Redis Community Cluster Edition, which is 100% compatible with Redis Community Cluster Edition commands.
The most challenging problem in migrating data from the Standalone Edition to the Cluster Edition is the command compatibility with usage specifications of the Cluster Edition. You need to pay attention to the following usage specification issues:
Redis Cluster Edition uses the hash algorithm to distribute keys to 16,000 slots. For more information on the principle, please see Redis Cluster Specification.
MGET
, MSET
, and DEL
commands. This mainly works by using Tencent Cloud's proprietary proxy to implement aggregated command computing among multiple nodes.Command Group | Command | Cross-Slot Support in Cluster Edition |
---|---|---|
keys | del | ✓ |
keys | exists | x |
keys | rename | x |
keys | renamenx | x |
keys | unlink | x |
list | rpoplpush | x |
list | blpop | x |
list | brpop | x |
list | brpoplpush | x |
sets | sdiff | x |
sets | sdiffstore | x |
sets | sinter | x |
sets | sinterstore | x |
sets | smove | x |
sets | sunion | x |
sets | sunionstore | x |
sorted sets | zinterstore | x |
sorted sets | zunionstore | x |
strings | bitop | x |
strings | mget | ✓ |
strings | mset | ✓ |
strings | msetnx | x |
hyperloglog | pfcount | x |
hyperloglog | pfmerge | x |
scripting | eval | x |
scripting | evalsha | x |
scripting | script exists | x |
Stream | xread | x |
Stream | xreadgroup | x |
KEY
parameter must be passed in for the EVAL
and EVALSHA
commands; otherwise, they cannot be executed.LOAD
, FLUSH
, KILL
, and EXIST
of SCRIPT
will be distributed to all master nodes in the cluster through the proxy.> eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 first second
1) "key1"
2) "key2"
3) "first"
4) "second"
The
key1
andkey2
parameters must be passed in when you use Lua.
watch key
command and then the multi
and exec
commands in the current version. This operation will be optimized in future versions to eliminate need to run watch key
first.
Through VIP encapsulation, Redis Cluster Edition provides a user experience in cluster mode comparable to the standalone edition, making it much easier for use in different scenarios. To increase the transparency to OPS, custom commands can be used. Access to each node in the cluster is supported by adding a parameter "node ID" on the right of the original command parameter list, such as COMMAND arg1 arg2 ... [node ID]. The node ID can be obtained through the cluster nodes
command or in the console:
10.1.1.1:2000> cluster nodes25b21f1836026bd49c52b2d10e09fbf8c6aa1fdc 10.0.0.15:6379@11896 slave 36034e645951464098f40d339386e9d51a9d7e77 0 1531471918205 1 connectedda6041781b5d7fe21404811d430cdffea2bf84de 10.0.0.15:6379@11170 master - 0 1531471916000 2 connected 10923-1638336034e645951464098f40d339386e9d51a9d7e77 10.0.0.15:6379@11541 myself,master - 0 1531471915000 1 connected 0-546053f552fd8e43112ae68b10dada69d3af77c33649 10.0.0.15:6379@11681 slave da6041781b5d7fe21404811d430cdffea2bf84de 0 1531471917204 3 connected18090a0e57cf359f9f8c8c516aa62a811c0f0f0a 10.0.0.15:6379@11428 slave ef3cf5e20e1a7cf5f9cc259ed488c82c4aa17171 0 1531471917000 2 connectedef3cf5e20e1a7cf5f9cc259ed488c82c4aa17171 10.0.0.15:6379@11324 master - 0 1531471916204 0 connected 5461-10922
Native command: info server
Custom command: info server ef3cf5e20e1a7cf5f9cc259ed488c82c4aa17171SCAN
Sample command: scan 0 238b45926a528c85f40ae89d6779c802eaa394a2scan 0 match a* 238b45926a528c85f40ae89d6779c802eaa394a2KEYS
Sample command: keys a* 238b45926a528c85f40ae89d6779c802eaa394a2
You are recommended to use a standalone (e.g., Jedis but not Jedis Cluster) client to access TencentDB for Redis Cluster Edition, as this access method is more efficient and simpler. You can also access through cluster clients, such as Jedis Cluster.
TencentDB for Redis Cluster Edition is 100% compatible with Codis Server commands with no modification to your business required. You can use DTS to quickly migrate data to TencentDB for Redis, which has the following advantages over Codis:
BLPOP
and SUBSCRIBE
.Currently, no tools can be used to exactly determine whether there will be compatibility problems in data migration from the Standalone Edition to the Cluster Edition. You can use the following two tools to evaluate the compatibility before migration. You are recommended to perform static evaluation, dynamic evaluation, and business verification before migration to ensure that data can be smoothly migrated.
info commandstats
command to check whether the Standalone Edition has ever executed cross-slot commands in order to determine whether there is compatibility problem.Usage:
./cluster_migrate_check.py host port password
Enter the corresponding Redis Standalone Edition information for
host
,port
, andpassword
.
Download the cluster_migrate_online_check dynamic verification tool and use it to simulate the execution of the psync
command on the client so as to sync incremental data from the Standalone Edition to the TencentDB for Redis Cluster Edition in real time. By performing real-time sync, you can check whether there is compatibility problem in write commands. This tool cannot test the compatibility of read commands.
The steps are as follows:
Usage:
./cluster_migrate_online_check srcip:srcport srcpasswd dstip:dstport dstpasswd
Environment variable parameters:
export logout=1 // It is used to print command in the console, which is disabled by default
export pipeline = 2000 // Number of concurrent pipelines, which is 1,000 by default
srcip:srcport
: Redis Standalone Edition address information, which is required.dstip:dstport
: TencentDB for Redis Cluster Edition address information, which is optional. If it is left empty, the tool can be used as a monitor.
To ensure successful data migration, you are recommended to test the business in the testing environment. You can connect the business in the testing environment to the TencentDB for Redis Cluster Edition and confirm whether all features can work properly before data migration.
For detailed directions, please see Migrating with DTS.
client-output-buffer-limit
parameter value is too small. You are recommended to set it to 512 MB or 1,024 MB by running the following command:config set client-output-buffer-limit "slave 1073741824 1073741824 600"
EVAL
command.
Was this page helpful?