Redis启动后是空的,虽然有.rdb文件 [英] Redis is empty after startup, altough there is an .rdb file
问题描述
在我的 redis-cli 中运行关闭保存"后,等待保存"命令完成(遵循 redis 日志)并备份我的 redis .rdb 文件,我尝试从头开始启动 redis 服务器,然后它以一个空的 DB 开始(dbsize =0!!!).
After I ran "shutdown save" in my redis-cli, waited for the "save" command to finish (followed the redis log) and backed up my redis .rdb file, I tried starting the redis server from the begining and it was started with an empty DB (dbsize =0!!!).
我能做什么?如何从 .rdb 文件恢复我的 redis?
What can I do ? How can I restore my redis from the .rdb file?
推荐答案
问题确实出在我的配置文件中.我将名为 tal.rdb
的 .rdb
文件保存为 old-tal.rdb
所以它不会受到影响.然后,我再次启动了我的 Redis 服务器,看到它有 0 个键,插入了 10000
个键并运行了 save"
命令,结果,我看到它有在正确的目录路径中创建了一个文件 dump.rdb
(Redis .rdb files
的默认 dbfilename
),尽管在配置文件中 dbfilename
是 tal.rdb
,所以我知道我的配置文件是坏的.为了解决这个问题,我用一个备份文件替换了配置文件,并用一个副本重新启动了我的 Redistal.rdb
然后它正确启动(10M 键).谢谢大家!
The problem was indeed in my configuration file. I saved my .rdb
file called tal.rdb
as old-tal.rdb
so it won't be effected.
Then, I've started my Redis server again, saw it has 0 keys, inserted 10000
keys and ran the save"
command and, as a result, I saw it has created a file dump.rdb
(the default dbfilename
for Redis .rdb files
) in the correct directory path, although in the configuration file the dbfilename
was tal.rdb
, so I understand my configuration file was bad. To fix this, I replaced the configuration file with a backed up file and restarted my Redis with a copy of tal.rdb
and then it was started correctly (10M keys).
Thanks everyone!
这篇关于Redis启动后是空的,虽然有.rdb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!