Redis-cli is the Redis command line interface. ApsaraDB for Redis allows you to use redis-cli to import existing Redis data to ApsaraDB for Redis for seamless migration.
Because ApsaraDB for Redis only supports access from the Alibaba Cloud intranet, the following steps only take effect on Alibaba Cloud ECS. If your ApsaraDB for Redis instance is not on ECS, you must copy the existing AOF file to ECS before importing data.
Redis-cli is the Redis command line interface. If you cannot use redis-cli on ECS, you can first download and install Redis before using redis-cli. See the official document here to download and install Redis on ECS.
Follow these steps if you have created an ApsaraDB for Redis instance on ECS:
Enable the AOF function for the existing ApsaraDB for Redis instance (skip this step if the AOF function has been enabled).
# redis-cli -h old_instance_ip -p old_instance_port config set appendonly yes
Use the AOF file to import data to the new ApsaraDB for Redis instance (assume that the generated AOF file is named append.aof).
# redis-cli -h aliyun_redis_instance_ip -p 6379 -a password --pipe < appendonly.aof
Note: If the AOF function does not need to be enabled for the existing ApsaraDB for Redis instance, you can run the following command to disable the function after data is imported:
# redis-cli -h old_instance_ip -p old_instance_port config set appendonly no