Redis is a key-value store, so there’s no way to query values in Redis database efficiently. One way is getting all keys by keys * and get values by get or mget one by one.

Another way, here I’ll describe in this post is, dumping all data to a file and converting it into JSON format, and find values using standard text edntir or grep or something like that.

Dump Redis data

If you use your own installation of Redis, you can get a dump file by save command. The backup file is located on a directory which you can know by config get command.

$ reids-cli -h
xxxxxx:6379> config get dir
1) "dir"
2) "/var/lib/redis/"
xxxxxx:6379> save

In my case, I use AWS ElastiCache. I dump the file using Backup operation and Copy it to a S3 Bucket.

Redis Rdbtools

Redis Rdbtools parses Redis dump.rdb files and export data to JSON.

rdb --command json ~/Downloads/dump.rdb