redis Can’t handle RDB format version 7 Fatal error loading the DB: Invalid argument. Exiting.

現象

啓動redis-server無提示,但是使用redis-cli連接時出現Could not connect to Redis at 127.0.0.1:6379: Connection refused

查看系統日誌:

$ cat /var/log/redis/redis.log

[50234] 15 Apr 07:51:39 * Server started, Redis version 2.4.10
[50234] 15 Apr 07:51:39 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[50234] 15 Apr 07:51:39 # Can't handle RDB format version 7
[50234] 15 Apr 07:51:39 # Fatal error loading the DB. Exiting.

原因

一般是低版本無法兼容高版本的 rdb 導致的。因爲我Docker裏面的redis版本較高,和服務器redis共用。

解決

# 查找  redis生成的dump.rdb文件進行刪除,再啓動 redis-server。

$ find / -name "dump.rdb"

$ sudo rm  /var/lib/redis/dump.rdb

$ systemctl start redis

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章