Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(error) ERR DUMP payload version or checksum are wrong #3348

Closed
xiajian opened this issue Jun 27, 2016 · 8 comments
Closed

(error) ERR DUMP payload version or checksum are wrong #3348

xiajian opened this issue Jun 27, 2016 · 8 comments

Comments

@xiajian
Copy link

xiajian commented Jun 27, 2016

I have a problem, which when I run the following command:

➜  Downloads redis-cli dump accout_37 > test_account.rdb
➜  Downloads cat test_account.rdb | redis-cli -x restore mytest_dump 0
(error) ERR DUMP payload version or checksum are wrong

It always happen to this problem: (error) ERR DUMP payload version or checksum are wrong, and I still remember that two weeks ago it was normal.

I am working in OS X 10.11.4, and I use homebrew install redis, and redis-cli version is 3.2.0

I google it , but I only find this Error appeared in http://redis.io/commands/restore。

In fact, My origin intention is that dump key from my machine , then scp dump file to remote server, then restore this key in remote server.

Sorry for poor English。

@rojingeorge
Copy link
Contributor

Hey @xiajian
Can you reconfirm if the redis version in your machine and remote server to be same or different?
Once RDB format changes, its not backward compatible between versions. So keep the versions same and give a retry.

@xiajian
Copy link
Author

xiajian commented Jun 27, 2016

Hey @rojingeorge
I execute the above command line in same machine。

At First, I guess maybe something wrong in my machine. Then ,I execute the following command line in remote server 1 (Centos 6.5, redis-cli 3.0.7), remote server 2 ( Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-79-generic x86_64, redis 2.8.4).

redis-cli set 'test' 123
redis-cli dump 'test' > test_123
cat test_123 | redis-cli -x restore mytest_dump 0
(error) ERR DUMP payload version or checksum are wrong

It still happened!! So,I guess it maybe something wrong in commandline or something wrong in redis.

And, I learn the above command line from http://stackoverflow.com/questions/16127682/how-to-use-redis-dump-and-restore-offline.

@badboy
Copy link
Contributor

badboy commented Jun 27, 2016

If you pipe the output of DUMP into a file, it will include an additional newline. You have to remove that.

$ tr -d '\n' < test_123 | redis-cli -x restore mytest_dump 0
OK

@xiajian
Copy link
Author

xiajian commented Jun 27, 2016

@badboy

Oh, It work! Thank you for your advice.

@antirez antirez closed this as completed Jul 5, 2016
@flisky
Copy link

flisky commented Jul 12, 2018

The dump content may contain newline, so it's safer to use head -c-1.

Full example: redis-cli --raw dump test | head -c-1 | redis-cli -x restore test1 0

Credited to StackOverflow

@angealtsai
Copy link

what if i excute like a linux shell file,

#!/bin/bash
src_ip=xx.xx.xx.xx
src_port=6379
src_auth=123456
dest_ip=127.0.0.1
dest_port=6379
i=1
redis-cli -h $src_ip -p $src_port -a $src_auth keys "*" | while read key
do
redis-cli -h $src_ip -p $src_port -a $src_auth --raw dump $key | perl -pe 'chomp if eof' | redis-cli -h $dest_ip -p $dest_port -n 0 -x restore $key 0
echo "$i migrate key $key"
((i++))
done

how could i deal with the “\n”?

@yujiaao
Copy link

yujiaao commented Sep 19, 2022

if the value contains \n (carrige return) then, head and tr version script not work properly, you can use split/dd/truncate or other bin utils to deal with the last bad byte.

@SCLogo
Copy link

SCLogo commented Nov 28, 2023

if the value contains \n (carrige return) then, head and tr version script not work properly, you can use split/dd/truncate or other bin utils to deal with the last bad byte.

Can you give an example ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants