Eric Guo's blog.cloud-mes.com

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Migrate DB From Redis 7.4 to 7.2 and Skip the RDB Version 12 Error

Permalink

After I copy redis dump.rdb from redis 7.4 to my Macbook homebrew redis 7.2 I got Can’t handle RDB format version 12 error:

# /opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
20066:C 17 Apr 2025 10:39:34.935 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
20066:C 17 Apr 2025 10:39:34.935 * Redis version=7.2.7, bits=64, commit=00000000, modified=0, pid=20066, just started
20066:C 17 Apr 2025 10:39:34.935 * Configuration loaded
20066:M 17 Apr 2025 10:39:34.935 * Increased maximum number of open files to 10032 (it was originally set to 256).
20066:M 17 Apr 2025 10:39:34.935 * monotonic clock: POSIX clock_gettime
Redis 7.2.7 (00000000/0) 64 bit
Running in standalone mode
Port: 6379
PID: 20066
https://redis.io
20066:M 17 Apr 2025 10:39:34.936 # WARNING: The TCP backlog setting of 511 cannot be enforced because kern.ipc.somaxconn is set to the lower value of 128.
20066:M 17 Apr 2025 10:39:34.936 * Server initialized
20066:M 17 Apr 2025 10:39:34.936 # Can't handle RDB format version 12
20066:M 17 Apr 2025 10:39:34.936 # Fatal error loading the DB, check server logs. Exiting.

Two option available, upgrade redis version via redis.io

Using high version

brew tap redis/redis
brew install --cask redis

The solution is ugly as redis will give you rc version of redis and it depend on the LLVM@18, which takes 1.7GB…

Stay redis 7.2

redis-cli shutdown
brew uninstall redis
brew untap redis/redis
# make sure your DB no need!
rm /opt/homebrew/var/db/redis/dump.rdb
rm /opt/homebrew/etc/redis-sentinel.conf
rm /opt/homebrew/etc/redis.conf
rm /opt/homebrew/etc/redis.conf.default
brew install redis
brew services start redis

Using redis-dump to dump and restore DB.

redis-dump -u 127.0.0.1:6379 -d 0 > db_db0.json
cat db_db0.json | redis-load -d 0

Comments