# 错误：RDB 校验和不匹配：期望 0xAB12CD34 但得到 0x5678EF90

- **ID:** `redis/rdb-checksum-mismatch-restore`
- **领域:** redis
- **类别:** data_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

磁盘上的 RDB 文件在创建后被损坏或修改，导致其校验和与期望值不同。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 6.2.0 | active | — | — |
| 7.0.0 | active | — | — |
| 7.2.0 | active | — | — |

## 解决方案

1. ```
   Use redis-check-rdb to validate and attempt repair: 'redis-check-rdb /var/lib/redis/dump.rdb' then if repair is needed 'redis-check-rdb --fix /var/lib/redis/dump.rdb'
   ```
2. ```
   Restore from the latest valid RDB backup or promote a replica to primary if replication is configured
   ```

## 无效尝试

- **Restarting Redis without fixing the RDB file** — Redis will reload the same corrupt RDB file and fail again with the same checksum error. (100% 失败率)
- **Deleting the RDB file and restarting** — This causes complete data loss unless a replica or backup is available. (95% 失败率)
- **Running redis-check-rdb with --fix on a heavily corrupted file** — The fix tool can only recover partially; if the checksum mismatch is severe, it may truncate the file and lose data. (60% 失败率)
