[英]How to reset source connector offsets in Apache Kafka-Connect server
After deleting the source connector from Kafka connect, saved offsets for this connector are still present in the Kafka.从 Kafka 连接中删除源连接器后,为该连接器保存的偏移量仍然存在于 Kafka 中。 When the same connector with the same name is started again then it starts to process data from the last saved offset.
当具有相同名称的相同连接器再次启动时,它将从上次保存的偏移量开始处理数据。 Changing the name of the connector is not a solution since it makes hard to automate connector submission.
更改连接器的名称不是解决方案,因为它很难自动提交连接器。
Is there a workaround for this problem (renaming the source connector is not an options)是否有解决此问题的方法(重命名源连接器不是一个选项)
Consume the offsets topic used by Connect;消费Connect使用的offsets topic; it is JSON, so you can inspect its format.
它是 JSON,因此您可以检查其格式。
Construct a series of messages that set the offset to 0 for the source构造一系列消息,将源的偏移量设置为 0
For a full example using the FileStreamSource, see this post有关使用 FileStreamSource 的完整示例, 请参阅此帖子
There is a KIP-199 and JIRAs as well that have been asking for tooling around this, also asking that deleting a source connector should delete its offsets.还有一个KIP-199和 JIRA 一直在要求解决这个问题,还要求删除源连接器应该删除它的偏移量。
what I found is that if you know the topic that the Kafka Connector is using, this might work: Kafka : Reset offset of a specific partition of topic and here's another reference that might help:https://gist.github.com/marwei/cd40657c481f94ebe273ecc16601674b我发现,如果您知道 Kafka 连接器正在使用的主题,这可能会起作用: Kafka:重置主题特定分区的偏移量,这是另一个可能有帮助的参考:https ://gist.github.com/marwei /cd40657c481f94ebe273ecc16601674b
I think I have had a similar issue and what I did was delete the topics that started with offset, which meant that I had to stop Kafka Connect, delete the applicable offset topics, and then restart Kafka Connect.我想我遇到了类似的问题,我所做的是删除以 offset 开头的主题,这意味着我必须停止 Kafka Connect,删除适用的 offset 主题,然后重新启动 Kafka Connect。 Not sure if that's the best option, but here are some options for your request.
不确定这是否是最佳选择,但这里有一些可满足您要求的选项。
Reset the offset for the consumer group for the kafka-connect connector.为 kafka-connect 连接器重置消费者组的偏移量。 The consumer group for all connectors are different - so it should be okay and not affect any other connectors.
所有连接器的消费者组都不同 - 所以应该没问题,不会影响任何其他连接器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.