在spring kafka中获取UNKOWN_PRODUCER_ID异常。

问题描述 投票:0回答:1

我使用spring boot 2.1.9和spring Kafka 2.2.9与Kafka链式交易。

我每次都会收到Kafka producer的警告,因此有些时候功能会无法使用,我想知道为什么会出现这些错误?

我想知道为什么会出现这些错误,是不是配置的问题?

2020-05-04 09:12:35.216  WARN [xxxxx-order-service,,,] 10 --- [ad | producer-8] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-8, transactionalId=xxxxx-Order-Service-JOg4T1vFzW4tuc-2] Got error produce response with correlation id 1946 on topic-partition process_event-0, retrying (2147483646 attempts left). Error: UNKNOWN_PRODUCER_ID
2020-05-04 09:12:35.327  WARN [xxxxx-order-service,,,] 10 --- [ad | producer-8] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-8, transactionalId=xxxxx-Order-Service-JOg4T1vFzW4tuc-2] Got error produce response with correlation id 1950 on topic-partition audit-0, retrying (2147483646 attempts left). Error: UNKNOWN_PRODUCER_ID
2020-05-04 09:12:53.512  WARN [xxxxx-order-service,,,] 10 --- [ad | producer-6] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-6, transactionalId=xxxxx-Order-Service-JOg4T1vFzW4tuc-0] Got error produce response with correlation id 5807 on topic-partition process_submitted_page_count-2, retrying (2147483646 attempts left). Error: UNKNOWN_PRODUCER_ID
2020-05-04 09:12:53.632  WARN [xxxxx-order-service,,,] 10 --- [ad | producer-6] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-6, transactionalId=xxxxx-Order-Service-JOg4T1vFzW4tuc-0] Got error produce response with correlation id 5811 on topic-partition process_event-0, retrying (2147483646 attempts left). Error: UNKNOWN_PRODUCER_ID
2020-05-04 09:12:53.752  WARN [xxxxx-order-service,,,] 10 --- [ad | producer-6] o.a.k.clients.producer.internals.Sender  : [Producer clientId=producer-6, transactionalId=xxxxx-Order-Service-JOg4T1vFzW4tuc-0] Got error produce response with correlation id 5816 on topic-partition audit-0, retrying (2147483646 attempts left). Error: UNKNOWN_PRODUCER_ID
spring-boot apache-kafka spring-kafka spring-transactions
1个回答
1
投票

我想你可能会遇到这种情况 发出.

当一个流应用的流量很少的时候,那么有可能消费者净化会连生产者发送的最后一条消息都删除(即这个生产者发送的所有消息都已经被消耗和提交了),结果,经纪人会删除这个生产者的ID。下一次当这个生产者尝试发送时,会得到这样的结果 UNKNOWN_PRODUCER_ID 错误代码,但在这种情况下,这个错误是可以重试的:生产者只需获得一个新的生产者ID并重试,然后这次就会成功。


建议的解决方案。升级Kafka

现在这个问题已经 已解决 对于版本 2.4.0+ 所以,如果你还在打这个,你需要升级到一个较新的Kafka版本。

替代解决方案。增加保留时间&amp。transactional.id.expiration.ms

另外,如果您不能(或不想)升级,那么您可以增加保留时间(log.retention.hours)以及 transactional.id.expiration.ms 定义了生产者被视为过期的非活动时间(默认为7天)。

© www.soinside.com 2019 - 2024. All rights reserved.