Redis data recovery method, redis-port tool to sync self-built redis rdb files to cloud database
1. Redis recovery mechanism
If only AOF is configured, load the AOF file to restore data when restarting;
If RDB and AOF are configured at the same time, the startup will only load the AOF file to restore the data;
If only RDB is configured, the startup will load the dump file to restore the data.
2. Recover data from aof
1 Note the following configuration
appendonly yes
dir /home/redis/data_6379/
2 Copy the AOF file to the Redis data directory
cp appendonly.aof /home/redis/data_6379/
3 Start redis-server
redis-server redis_6379.conf
3. Restoring data from RDB files
1 Note the following configuration
appendonly no
dir /home/redis/data_6379/
2 Copy the RDB file to the Redis data directory
cp dump.db /home/redis/data_6379/
3 Start redis-server
redis-server redis_6379.conf
Use the redis-port tool to synchronize the self-built redis rdb file to ApsaraDB for it
download redis-port
redis-port address
Example of use
./redis-port restore --input=x/dump.rdb --target=dst_host:dst_port --auth=dst_password [--filterkey="str1|str2|str3"] [--targetdb=DB] [--rewrite] [--bigkeysize=SIZE] [--logfile=REDISPORT.LOG]
Parameter Description
x/dump.rdb : path to dump file of self-built redis
dst_host : ApsaraDB for redis domain name
dst_port : ApsaraDB for redis port
dst_password : ApsaraDB for redis password
str1|str2|str3 : filter keys with str1 or str2 or str3
DB : the DB that will be synchronized into ApsaraDB for redis
rewrite : overwrite the already written key
bigkeysize=SIZE : When the written value is larger than SIZE, go to the big key writing mode
View the data synchronization status according to the redis-port log
restore: rdb done
Data synchronization is complete when presented .
Reference article: https://help.aliyun.com/document_detail/66008.html
0 Comments