# 错误：RDB 校验和不匹配：预期 0x8a2b3c4d 但得到 0x9e1f0a5b

- **ID:** `redis/rdb-checksum-mismatch-on-replica`
- **领域:** redis
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在复制过程中，从主节点传输到从节点的 RDB 文件在传输或磁盘上已损坏，导致校验和验证失败。

## 版本兼容性

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

## 解决方案

1. ```
   在主节点上运行手动 BGSAVE 以生成新的 RDB 文件，然后在从节点上使用 REPLICAOF NO ONE 和 REPLICAOF master-ip master-port 触发完全重新同步。
   ```
2. ```
   使用 fsck 或 smartctl 检查主节点和从节点的磁盘健康状况，并确保网络稳定性（例如 TCP 校验和卸载）以防止传输过程中的损坏。
   ```
3. ```
   如果错误持续存在，使用带校验和验证的 rsync 手动将 RDB 文件从主节点复制到从节点，然后重启从节点加载文件。
   ```

## 无效尝试

- **** — Retrying the replication without fixing the underlying network or disk issue will cause the same checksum mismatch on subsequent attempts. (80% 失败率)
- **** — Disabling RDB checksums via rdb-checksum no in redis.conf removes the error but allows silent data corruption to propagate. (90% 失败率)
- **** — Restarting the replica without addressing the master's RDB file integrity may load a corrupted dataset from persistent storage. (70% 失败率)
