1

I am looking to export everything in Redis to a file using redis-cli

I understand

redis-cli -h XXXX --csv get keyname[****] > filename.csv

will export the one given key to a file, but how do I get every single key/value that exists into a file?

lsg
  • 11
  • 2

1 Answers1

1

There is no built-in way to do that, but with some coding, you can achieve that. In your preferred programming language, you can implement the following logic:

  1. SCAN the database to obtain key names
  2. For each key name obtained, issue a TYPE call to get its value type.
  3. Per value type, do the equivalent read command (e.g. GET for strings, HGETALL for hashes...) and manipulate the reply to CSV format.
Itamar Haber
  • 47,336
  • 7
  • 91
  • 117