ERM redis data_error ai_generated partial

RDB checksum mismatch: expected 0x<hex> but got 0x<hex>

ID: redis/rdb-checksum-mismatch

Also available as: JSON · Markdown · 中文
75%Fix Rate
92%Confidence
1Evidence
2023-06-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Redis 6.2.0 active
Redis 7.0.0 active
Redis 7.2.0 active

Root Cause

The RDB file on disk has been corrupted or truncated, causing its checksum to not match the expected value calculated by Redis during loading.

generic

中文

磁盘上的 RDB 文件已损坏或被截断,导致其校验和与 Redis 加载时计算的值不匹配。

Official Documentation

https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/

Workarounds

  1. 90% success Restore from a recent backup RDB file: copy the backup to the dump directory and restart Redis. Example: cp /backup/dump.rdb /var/lib/redis/dump.rdb; systemctl restart redis.
    Restore from a recent backup RDB file: copy the backup to the dump directory and restart Redis. Example: cp /backup/dump.rdb /var/lib/redis/dump.rdb; systemctl restart redis.
  2. 75% success Use redis-check-rdb to repair the file: run redis-check-rdb /var/lib/redis/dump.rdb to fix minor corruption. If unrecoverable, use AOF file as fallback if enabled.
    Use redis-check-rdb to repair the file: run redis-check-rdb /var/lib/redis/dump.rdb to fix minor corruption. If unrecoverable, use AOF file as fallback if enabled.
  3. 85% success Enable AOF persistence alongside RDB to reduce reliance on RDB. Set appendonly yes in redis.conf and restart.
    Enable AOF persistence alongside RDB to reduce reliance on RDB. Set appendonly yes in redis.conf and restart.

中文步骤

  1. Restore from a recent backup RDB file: copy the backup to the dump directory and restart Redis. Example: cp /backup/dump.rdb /var/lib/redis/dump.rdb; systemctl restart redis.
  2. Use redis-check-rdb to repair the file: run redis-check-rdb /var/lib/redis/dump.rdb to fix minor corruption. If unrecoverable, use AOF file as fallback if enabled.
  3. Enable AOF persistence alongside RDB to reduce reliance on RDB. Set appendonly yes in redis.conf and restart.

Dead Ends

Common approaches that don't work:

  1. 95% fail

    Redis will fail to load the same corrupted RDB file again, causing repeated crashes or startup failures.

  2. 99% fail

    RDB files are binary and have a complex structure; manual editing almost always results in further corruption.

  3. 50% fail

    Deleting the RDB file causes total data loss; it is only acceptable if backups exist.