Redis to JSON and back again
Redis to JSON and back again. Dump and load Redis databases to/from JSON files.
One of:
gem 'redis-dump', '~> 0.4.0'gem install redis-dumpgit clone [email protected]:delano/redis-dump.gitThere are two executables: redis-dump and redis-load.
$ redis-dump
$ redis-dump -u 127.0.0.1:6379 > db_full.json
$ redis-dump -u 127.0.0.1:6379 -d 15 > db_db15.json
$ :
# Note the leading colon is important for specifying no username.
$ redis-dump -u :[email protected]:9055All redis datatypes are output to a simple JSON object. All objects have the following 5 fields:
Here are examples of each datatype:
…One of the purposes of redis-dump is the ability to restore the database to a known state. When you restore a redis database from a redis-dump file, the expires are reset to their values at the time the dump was created. This is different from restoring from Redis' native .rdb or .aof files (expires are stored relative to the actual time they were set).
For most sensitive data, you should consider encrypting the data directly without writing first to a temp file. You can do this using the power of gpg and file descriptors. Here are a couple examples:
# Encrypt the data (interactive)
$ redis-dump -u 127.0.0.1:6379 -d 15 | gpg --force-mdc -v -c > path/2/backup-db1Bug reports and pull requests are welcome on GitHub at https://github.com/delano/redis-dump.
The gem is available as open source under the terms of the MIT License.
No open issues yet, or sync has not completed.