ERM redis data_error ai_generated partial

RDB 校验和不匹配:期望 0x<hex> 但得到 0x<hex>

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

ID: redis/rdb-checksum-mismatch

其他格式: JSON · Markdown 中文 · English
75%修复率
92%置信度
1证据数
2023-06-12首次发现

版本兼容性

版本状态引入弃用备注
Redis 6.2.0 active
Redis 7.0.0 active
Redis 7.2.0 active

根因分析

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

English

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

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 95% 失败

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

  2. 99% 失败

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

  3. 50% 失败

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