Command line redis-cli dump

3,196 views
Skip to first unread message

Chris Love

unread,
May 14, 2012, 8:08:20 PM5/14/12
to redi...@googlegroups.com
Hi all

I am having a problem running redis-cli dump on the command line

redis-cli dump lsa_data_html_hide

I can see the dump file

redis-cli dump lsa_data_html_hide > /tmp/data.dmp

The redirect to a file completely changes the data format.

Recommendations?

Thanks

Chris

Sripathi Krishnan

unread,
May 14, 2012, 11:02:48 PM5/14/12
to redi...@googlegroups.com
The dump command returns binary content. When it is displayed on screen, redis-cli escapes non-printable characters using the \xHH encoding format, where HH is hexadecimal notation. But when you redirect it to the file, it is written in the raw binary format.

The \xHH escaping is a redis-cli thing only. When you use a client library, you will get back the raw bytes instead of the encoded string.

--Sri



Chris

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/4PmThsoQjPoJ.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Pieter Noordhuis

unread,
May 15, 2012, 12:17:53 AM5/15/12
to redi...@googlegroups.com
Hi Chris,

Are you sure you want to use DUMP? The command returns a
Redis-specific binary encoding, that is meant to be passed to the
RESTORE command. These two commands can be used to move data between
Redis instances. If instead you are looking to just get the string
value stored at the key, you can use GET and when redirected to a file
redis-cli won't touch the content, like Sripathi describes.

Cheers,
Pieter

Chris Love

unread,
May 15, 2012, 12:00:10 PM5/15/12
to redi...@googlegroups.com
Peter

Yes I want to use dump, since I am trying to back up a specific key during development testing Then are tesing restore the value.

Wrote a lua script to move the key to a different key. So no worries.

Thanks

Chris

Josiah Carlson

unread,
May 15, 2012, 12:03:17 PM5/15/12
to redi...@googlegroups.com
Move, or copy? Because there is a command called 'RENAME' which will
move keys in the same database, and 'MOVE' that will move keys to
different databases.

Regards,
- Josiah
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/cEWQKs8cjBYJ.

Chris Love

unread,
May 15, 2012, 7:32:10 PM5/15/12
to redi...@googlegroups.com
Neither. Restore

Josiah Carlson

unread,
May 15, 2012, 8:14:28 PM5/15/12
to redi...@googlegroups.com
I was just trying to disambiguate what you were talking about. You
said "back up", then you said you wrote a script to move the key.
Those are semantically different operations ;)

If you are backing up the key, then yes, your use of dump/restore is
the correct use (modulo the time it takes to dump/restore large keys).

Since you are not "moving" it, then using the semantically different
MOVE and RENAME commands are not what you are looking for (which you
already know).

Regards,
- Josiah

On Tue, May 15, 2012 at 4:32 PM, Chris Love <ch...@cnmconsulting.net> wrote:
> Neither. Restore
>
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/auN0GfR9RdsJ.
Reply all
Reply to author
Forward
0 new messages