Kafka 消费者:将分区 xxxx1-0 的偏移量重置为偏移量 25143。每次启动它时

Kafka 消费者:将分区 xxxx1-0 的偏移量重置为偏移量 25143。每次启动它时

话题-A:

o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-1, groupId=group-5] Revoking previously assigned partitions []
o.a.k.c.c.i.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=group-5] (Re-)joining group
o.a.k.c.c.i.AbstractCoordinator - [Consumer clientId=consumer-1, groupId=group-5] Successfully joined group with generation 1
o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-1, groupId=group-5] Setting newly assigned partitions [A1-0]
o.a.k.c.consumer.internals.Fetcher - [Consumer clientId=consumer-1, groupId=group-5] Resetting offset for partition A1-0 to offset 25143.

最后一条消息:

o.a.k.c.consumer.internals.Fetcher - [Consumer clientId=consumer-1, groupId=group-5] Resetting offset for partition A1-0 to offset 25143.

这导致我每次启动时都重置偏移量,假设我运行到数字 25200,然后我关闭它,下次启动时偏移量会重置为 25143,但我想继续使用最后的偏移量。

这是另一个主题,这是我想要的正常结果:
Topic-wallet:

org.apache.kafka.clients.Metadata - Cluster ID: iQU30Fo1TViA2rkH9cxVYQ
o.a.k.c.c.i.AbstractCoordinator - [Consumer clientId=consumer-3, groupId=wallet-1] Discovered group coordinator localhost:9092 (id: 2147483646 rack: null)
o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-3, groupId=wallet-1] Revoking previously assigned partitions []
o.a.k.c.c.i.AbstractCoordinator - [Consumer clientId=consumer-3, groupId=wallet-1] (Re-)joining group
o.a.k.c.c.i.AbstractCoordinator - [Consumer clientId=consumer-3, groupId=wallet-1] Successfully joined group with generation 13
o.a.k.c.c.i.ConsumerCoordinator - [Consumer clientId=consumer-3, groupId=wallet-1] Setting newly assigned partitions [blockaddresscomplete3-0]

我应该如何设置Topic-A?

答案1

我遇到过同样的问题。原因是输入主题中的消息保留期已过。请运行控制台消费者命令并查找主题中的消息数量。希望这个建议能解决。

相关内容