An on-premises Redis Database (RDB) file can be restored to an Tair (Redis OSS-compatible) instance. To accomplish this, you first need to restore the RDB file to a self-managed Redis database, and then migrate data from the self-managed Redis database to the Tair (Redis OSS-compatible) instance.
Procedure
Create an Tair (Redis OSS-compatible) instance. For more information, see Step 1: Create an ApsaraDB for Redis instance. If you already have an Tair (Redis OSS-compatible) instance, skip this step.
Restore the on-premises RDB file to a self-managed Redis database.
ImportantIf an RDB file already exists in the directory (dir) specified in the Redis configuration file (redis.conf), back up the existing RDB file before you migrate the new RDB file to prevent accidental loss of existing data.
If append-only file (AOF) persistence is enabled for the self-managed Redis database, the AOF is used in preference to restore data upon service restart. This may prevent the data in the RDB file from being successfully restored to Redis. In this case, disable AOF persistence. If the AOF in the specified directory (dir) has been backed up to another directory, you can then restart Redis. If you want to enable AOF persistence again after Redis is restarted, you can run the
redis-cli CONFIG SET appendonly yes
command. After the command is run, Redis creates a new AOF in the specified directory and writes the data currently in memory to the new AOF. However, this configuration applies only to the currently running Redis database. To permanently enable AOF persistence, setappendonly
toyes
in the Redis configuration file (redis.conf).
Move the RDB file to the specified directory (dir) in the Redis configuration file (redis.conf).
Modify the name of the RDB file so that it is the same as the file name (dbfilename) specified in the Redis configuration file (redis.conf).
Restart the self-managed Redis database.
Query Redis data and check that the data in the RDB file has been restored to the self-managed Redis database.
Use Data Transmission Service (DTS) to migrate data from the self-managed Redis database to the Tair (Redis OSS-compatible) instance. For more information, see Migrate data from a self-managed Redis database to an ApsaraDB for Redis instance.
References
For information about how to restore AOFs from self-managed Redis databases to Tair (Redis OSS-compatible) instances, see Use AOF files to migrate data.