Note: This project is started as a fork of Yann Hamon's redis-dump-go.
Note
This project is in the Experimental Stage.
We declare this project experimental to set clear expectations for your usage. There could be known or unknown bugs, the API could evolve, or the project could be discontinued if it does not find community adoption. While we cannot provide professional support for experimental projects, we’d be happy to hear from you if you see value in this project!
Dumps Redis keys & values to a file. Similar in spirit to https://www.npmjs.com/package/redis-dump and https://github.com/delano/redis-dump but:
- Will dump keys across several processes & connections
- Uses SCAN rather than KEYS * for much reduced memory footprint with large databases
- Easy to deploy & containerize - single binary.
- Generates a RESP file rather than a JSON or a list of commands. This is faster to ingest, and recommended by Redis for mass-inserts.
- Dumps all databases present on the Redis server
- Keys TTL are preserved by default
- Configurable Output (Redis commands, RESP)
- Redis password-authentication
You can download one of the pre-built binaries for Linux, Windows and macOS from the releases page.
Or if you have Go SDK installed on your system, you can get the latest upstash-redis-dump
by running:
go install github.com/upstash/upstash-redis-dump@latest
$ upstash-redis-dump -h
Usage of upstash-redis-dump:
-batchSize int
HSET/RPUSH/SADD/ZADD only add 'batchSize' items at a time (default 1000)
-cacert string
TLS CACert file path
-cert string
TLS Cert file path
-db uint
only dump this database (default: all databases)
-filter string
Key filter to use (default "*")
-host string
Server host (default "127.0.0.1")
-key string
TLS Key file path
-n int
Parallel workers (default 10)
-noscan
Use KEYS * instead of SCAN - for Redis <=2.8
-output string
Output type - can be resp or commands (default "resp")
-pass string
Server password
-port int
Server port (default 6379)
-s Silent mode (disable logging of progress / stats)
-tls
Enable TLS
-ttl
Preserve Keys TTL (default true)
$ upstash-redis-dump -db 0 -host eu1-moving-loon-6379.upstash.io -port 6379 -pass PASSWORD -tls > redis.dump
Database 0: 9 keys dumped
redis-cli --tls -u redis://[email protected]:6379 --pipe < redis.dump