Introduction
Redis-cli is the command line client tool of Redis, which allows users to interact with the Redis server through the command line.
If the Redis service does not support generating AOF files, you can try to use the Redis-cli tool to generate an RDB file and import it into the DCS instance with other tools (such as Redis-Shake).
Description
The source Redis instance must support the SYNC command, which is required when exporting the RDB file using Redis-cli.
Step 1: Preparation for Data Export
For active/standby or cluster instances, there is a delay in writing data into an RDB file. Therefore, before migrating the data, learn the RDB policy configurations of the Redis instance to be migrated (delay policies are configured in the redis.conf file).
To ensure that the RDB file contains complete cached data, it is recommended to suspend your business system first.
Step 2: Exporting an RDB File
Description
It is recommended to perform the migration during off-peak hours.
When exporting Redis Cluster data, individually export the data of each node in the cluster, and then import the data node by node.
Use the following command to export the RDB file:
./redis-cli -h {redis_address} -p {redis_port} -a {password} --rdb {output.rdb}
After executing the command, Transfer finished with success. is displayed, indicating that the file has been successfully exported.
Step 3: Uploading the RDB file to eSurfing Cloud ECS
To save the transmission time, compress the RDB file first.
Upload the compressed file to eSurfing Cloud ECS using an appropriate mode (for example, SFTP or SCP mode).
Description
Ensure that the ECS has sufficient disk space for data file storage, and can communicate with the DCS instance. Generally, the ECS and DCS instances are configured to belong to the same VPC and subnet, and the configured security group rules do not restrict access ports.
Step 4: Importing Data
Use Redis-shake to import data.
Step 5: Verifying Migration
After the data is imported successfully, access the DCS instance and run the dbsize command to check whether the data has been successfully imported.
If the data import fails, analyze the cause, modify the data import statement, run the flushall or flushdb command to clear the cached data in the instance, and import the data again.