4

Following the indications in here: Redis-QuickStart I installed in my Ubuntu 18.04.01 Server Edition the latest stable Redis release : download.redis.io/redis-stable.tar.gz and tested the result of the compilation:

\o/ All tests passed without errors!

As suggested, I copied redis-server and redis-cli into /usr/local/bin:

marco@pc01:~/redis-stable$ sudo cp src/redis-server /usr/local/bin/
marco@pc01:~/redis-stable$ sudo cp src/redis-cli /usr/local/bin/

But when just executing the redis-server binary it says it can't handle RDB format version 9

marco@pc01:~$ redis-server
11700:C 18 Apr 08:18:52.007 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
11700:C 18 Apr 08:18:52.007 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, 
pid=11700, just started
11700:C 18 Apr 08:18:52.007 # Warning: no config file specified, using the default config. In 
order to specify a config file use redis-server /path/to/redis.conf
11700:M 18 Apr 08:18:52.007 * Increased maximum number of open files to 10032 (it was 
originally set to 1024).
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 11700
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

11700:M 18 Apr 08:18:52.008 # Server initialized
11700:M 18 Apr 08:18:52.008 # Can't handle RDB format version 9
11700:M 18 Apr 08:18:52.008 # Fatal error loading the DB: Invalid argument. Exiting.

Searching for some hints I found this : Can't handle RDB format version 8 whose solution was to use the lastest version of redis. But I downloaded the latest stable release of Redis!!! So... how to solve the problem?

Looking forward to your kind help. Marco

As said in the comment below, I SOLVED the problem by deleting /home/marco/dump.rdb file.

1 Answers1

0

I realize this is an old question, but this error can still occur. So if anyone ends up on this page, here's what was happening:

Depending on its configuration, Redis can store its data in an .rdb file, which it will load again into memory when restarted. During this loading process, it validates the "RDB version" that the file was written with (think of it as a format, like "the v9 format"):

rdbver = atoi(buf+5);
if (rdbver < 1 || rdbver > RDB_VERSION) {
    serverLog(LL_WARNING,"Can't handle RDB format version %d",rdbver);
    return C_ERR;
}

If that version is greater than what the server currently supports, it fails with the error that you saw, e.g. Can't handle RDB format version 9".

We can find where RDB_VERSION is defined and track its value across Git tags to produce a range of Redis versions for each RDB version.

As I am writing this the current version is 12:

/* The current RDB version. When the format changes in a way that is no longer
 * backward compatible this number gets incremented. */
#define RDB_VERSION 12

From what I could find in the git repo, here's an approximate mapping of RDB versions to Redis versions:

v12 -> 7.4-rc1~252 -- HEAD
v11 -> 7.2-rc1~174 -- 7.2-rc1~173
v10 -> 7.0-rc1~413 -- 7.0-rc1~412
v9 -> 5.0-rc1~91 -- 5.0-rc1~89^2~1
v8 -> 4.0-rc1~231 -- 4.0-rc1~230
v7 -> 3.2-rc1~462^2~10 -- 3.2-rc1~171
v6 -> 3.0.0-beta1~1012 -- 3.0.0-beta1~1011
v5 -> 3.0.0-beta1~1066 -- 3.0.0-beta1~1065
v4 -> 3.0.0-beta1~1112 -- 3.0.0-beta1~1111

Given that your logs show Redis 4.0.9 starting up, it's not surprising that it would fail to load an RDB file at version 9 since this was introduced later.

I see that the issue was resolved by deleting an RDB file that Redis was picking up, which was apparently unexpected. With an RDB version of 9, this file was likely created with a build of Redis at version 5 or 6.

nff
  • 1