I have redis instance with 10 keys in qa env.
the instance is configured to use dump.rdb
in /tmp
directory .
I ran "save" command and saw new dump.rdb
file that was created .
then I created new instance on other host .
copied the dump.rdb
to the new instance in "dir" directory as it is configured in redis.conf
file.
I stopped the new instance and then started it.
if I run "keys *" command on the new instance I get null .
probably the dump.rdb
file was not read when the server was started .
I followed the post
https://stackoverflow.com/questions/14497234/how-to-recover-redis-data-from-snapshotrdb-file-copied-from-another-machine
but didn't succeed.
the steps on the the old instance :
set aaa 111
set bbb 222
etc etc
SAVE
scp dump.rdb new_host:/dir
on the new host :
stop redis serivce
start redis service .
redis-cli -h ... -p ...
keys *
(empty list or set)
and ideas ?
Best Answer
found what the problem was .
need to start the new server with a specific dump file as a parameter when starting the service though the "dir" parameter is set in the config file , it's written that when you start the service redis looks for rdb file which is configured, it didn't work for me. had to run redis-server /path_to_config_file --dbfilename dump.rdb --dir /path_to_directory_where_the_dump_file_is_located
the command above did the job .