Dump and restore data for a specific key in redis

I want to backup a specific key in my redis, which has several keys. My redis has many keys, and I do not want to completely copy my redis data. I went through http://redis.io/commands . There I discovered that there is a dump of the command with which I can take a dump of a certain key as follows:

 redis> dump "myKey"

But it gives output in hexadecimal format only in the redis console. Is it possible to store data for a specific key in a file, and then import it on that key?

+3
source share
3 answers

/ ( , , ), Redis . . .

- / :

bwood@mybox:~$ redis-cli --raw dump mykey | head -c-1 > myfile
bwood@mybox:~$ cat myfile | redis-cli -x restore mynewkey 0
+12

script, DUMP , , RESTORE.

+1

:

bwood@mybox:~$ redis-cli --raw dump mykey | head -c-1 > myfile
bwood@mybox:~$ cat myfile | redis-cli -x restore mynewkey 0

, , : head: count - -1

head:

redis-cli --raw dump mykey > myfile

, .

:

 0561 7074 7572 6520 fa00 5be0 0526 015d
 7d06 00a7 afed c100 323d 400a 

"0a" , .

0561 7074 7572 6520 fa00 5be0 0526 015d
7d06 00a7 afed c100 323d 40
-1
source

All Articles