# 再均衡进行中异常：消费者组正在再均衡，因此另一个再均衡已在进行中

- **ID:** `kafka/consumer-group-rebalance-timeout`
- **领域:** kafka
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 82%

## 根因

消费者组再均衡在另一个再均衡仍在进行时被触发，通常由消费者加入缓慢或网络延迟引起。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Kafka 3.6.0 | active | — | — |
| Kafka 3.7.0 | active | — | — |

## 解决方案

1. ```
   Set `rebalance.timeout.ms=120000` in consumer config to allow more time for rebalance completion, and ensure `max.poll.records=500` to reduce processing load per poll.
   ```
2. ```
   Use static group membership by setting `group.instance.id` to a unique value per consumer to reduce rebalance frequency.
   ```
3. ```
   Example fix in Java consumer: `props.put(ConsumerConfig.REBALANCE_TIMEOUT_MS_CONFIG, 120000); props.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 500);`
   ```

## 无效尝试

- **** — It only postpones the error; the rebalance will still fail if consumers are slow. (70% 失败率)
- **** — It exacerbates the problem by making consumers appear dead prematurely. (85% 失败率)
