Redis Backup Restore Parser with RDB

本文介绍如何使用AWS控制台备份任何Redis数据库,并将其导出到S3作为RDB文件。此外,还介绍了如何通过解析RDB文件来查看Redis数据的具体内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Redis Backup Restore Parser with RDB

We can backup any Redis DB in AWS console.

We can also directly export the backup to S3 as a RDB file. Select the backup Data and click ‘Copy’.

Sometimes, we need to give access permission to AWS to our S3.
Follow the link https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Snapshots.Exporting.html

I add
All other regions – 540804c33a284a299d2547575ce1010f2312ef3da9b3a053c8bc45bf233e4353

to our S3 bucket permission.

We can also create a Redis Cache Service seed from our RDB file. But for cluster, we need 3 shard files. So that means, we can backup our master-replica, then we can create a master-replica. We can back up 3 shard cluster, we can create a 3 shard cluster. But we can not do from master-replica to 3 shard cluster.

Another solution is that we can download the RDB file.

Then we can use a tool to parse the RDB file.
https://github.com/sripathikrishnan/redis-rdb-tools

Here is how I install it.

git clone https://github.com/sripathikrishnan/redis-rdb-tools
cd redis-rdb-tools
sudo python3 setup.py install

Check the size of one key
> redis-memory-for-key -s redishost -p 6379 job_787_2417109
Key job_787_2417109
Bytes 7292.0
Type hash
Encoding hashtable
Number of Elements 60
Length of Largest Element 1498

get all keys and values to a output file
> rdb --command justkeyvals --key "user*" ~/Downloads/stagejobs20170223.rdb -f output.json

get all value in JSON format
> rdb --command json ~/Downloads/stagejobs20170223.rdb

References:
https://github.com/sripathikrishnan/redis-rdb-tools

http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Snapshots.Exporting.html
http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Snapshots.SeedingRedis.html
https://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/Snapshots.Exporting.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值