Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis-cli --csv option (exporting to csv)

Tags:

I would like to export a subset of my Redis data on the slave to a csv file. I notice a new csv output option was added to redis-cli but I am unable to find documentation of how it works. Enabling the option prints the command outputs to screen in csv format. What is the best way to get this into a csv file?

like image 554
Boom Shakalaka Avatar asked Jul 06 '12 19:07

Boom Shakalaka


People also ask

How use Redis command line?

To start Redis client, open the terminal and type the command redis-cli. This will connect to your local server and now you can run any command. In the above example, we connect to Redis server running on the local machine and execute a command PING, that checks whether the server is running or not.

What does Redis-CLI command do?

The Redis command line interface ( redis-cli ) is a terminal program used to send commands to and read replies from the Redis server.


1 Answers

Cutting edge!

I've just looked at the source code & all it does is output the commands as comma separated values to stdout. Which is no big surprise.

So you could just redirect it to a file, in the standard way, as long as you're on Linux?

e.g./

redis-cli --csv your-command > stdout.csv 2> stderr.txt 
like image 127
gef Avatar answered Sep 21 '22 19:09

gef