kafka network_error ai_generated true

事务协调器不可用异常:事务协调器不可用

org.apache.kafka.common.errors.TransactionCoordinatorNotAvailableException: The transaction coordinator is not available

ID: kafka/transaction-coordinator-not-available

其他格式: JSON · Markdown 中文 · English
82%修复率
87%置信度
1证据数
2024-02-10首次发现

根因分析

作为事务ID的事务协调器的代理已关闭或不可达。

English

The broker acting as transaction coordinator for the transactional ID is down or unreachable.

generic

官方文档

https://kafka.apache.org/documentation/#transaction_config

解决方案

  1. 检查代理健康状况,必要时重启协调器代理:在受影响的代理上执行 systemctl restart kafka。
  2. 增加 transaction.timeout.ms 以给协调器更多时间恢复,例如 props.put("transaction.timeout.ms", "900000");
  3. 等待协调器可用并使用指数退避重试事务。

无效尝试

常见但无效的做法:

  1. 90% 失败

    Restarting the application without ensuring the coordinator broker is healthy will retrigger the error.

  2. 85% 失败

    Changing the transactional.id in config causes the producer to be fenced and lose transaction state.