# 节点纪元冲突：节点 127.0.0.1:7001 的纪元为 100，但另一个节点 127.0.0.1:7002 声称具有相同纪元

- **ID:** `redis/cluster-node-epoch-conflict`
- **领域:** redis
- **类别:** runtime_error
- **错误码:** `ERR`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

两个 Redis 集群节点具有相同的纪元号，导致集群状态同步冲突，阻止了正确的故障转移或配置更新。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 6.2 | active | — | — |
| 7.0 | active | — | — |
| 7.2 | active | — | — |

## 解决方案

1. ```
   Use CLUSTER RESET on one of the conflicting nodes to reset its epoch to 0, then rejoin the cluster. Example: redis-cli -h 127.0.0.1 -p 7001 CLUSTER RESET HARD
   ```
2. ```
   Force the cluster to rebalance epochs by failing over the master on the node with the conflicting epoch. Example: CLUSTER FAILOVER FORCE on a replica of that master.
   ```
3. ```
   Manually update the nodes.conf file on one node to assign a unique epoch (e.g., increment by 1) and restart the node.
   ```

## 无效尝试

- **Manually set the epoch on one node using CLUSTER SET-CONFIG-EPOCH with a random value.** — This can cause further conflicts if not coordinated; the cluster may reject the change if the epoch is lower than the current one. (60% 失败率)
- **Restart both conflicting nodes simultaneously.** — The epochs are stored in the nodes.conf file; restarting does not change them, so the conflict persists. (80% 失败率)
- **Delete the nodes.conf file on one node and let it rejoin the cluster.** — This can cause data loss and disrupt cluster topology; the rejoining node may still get a conflicting epoch. (50% 失败率)
