kafka runtime_error ai_generated true

org.apache.kafka.common.errors.TransactionalCoordinatorFencedException:纪元5的事务协调器已被隔离

org.apache.kafka.common.errors.TransactionalCoordinatorFencedException: The transactional coordinator with epoch 5 has been fenced

ID: kafka/transaction-coordinator-fenced

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

版本兼容性

版本状态引入弃用备注
kafka 3.5.0 active
kafka 3.6.2 active
kafka 3.7.0 active

根因分析

新的事务协调器接管,由于领导者选举或代理故障而隔离了旧协调器。

English

A new transactional coordinator has taken over, fencing the old coordinator due to leader election or broker failure.

generic

官方文档

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

解决方案

  1. Restart the transactional producer to re-initialize the coordinator connection: 'producer.initTransactions();' in code, or restart the application.
  2. Ensure all brokers have consistent transaction.state.log.replication.factor and min.insync.replicas settings, then restart the broker with the highest epoch: 'bin/kafka-server-stop.sh && bin/kafka-server-start.sh config/server.properties'

无效尝试

常见但无效的做法:

  1. 85% 失败

    Manually reassigning partitions without checking coordinator health causes repeated fencing.

  2. 70% 失败

    Disabling idempotent producer to avoid fencing breaks exactly-once semantics and may cause duplicates.