简体   繁体   English

如何在 Apache Kafka-Connect 服务器中重置源连接器偏移量

[英]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.

相关问题 Kafka-connect s3 源连接器配置问题 - Kafka-connect s3 source connector config issue 如何在没有连接器的情况下创建正确的kafka-connect插件? - How to create proper kafka-connect plugin without connector? 我们如何重置与 Kafka Connect 源连接器关联的 state? - How do we reset the state associated with a Kafka Connect source connector? Kafka 连接器“无法连接到服务器” - 连接到融合云的 dockerized kafka-connect worker - Kafka connector "Unable to connect to the server" - dockerized kafka-connect worker that connects to confluent cloud 融合-kafka-connect-JDBC源连接器-ORA-00933:SQL命令未正确结束 - confluent - kafka-connect - JDBC source connector - ORA-00933: SQL command not properly ended 如何在 kafka-connect Confluent 平台的 elasticsearch sink 连接器配置中使用 ca cert? - How to use ca cert in elasticsearch sink connector configuration for kafka-connect confluent platform? 更改 connect.offsets kafka 连接器错误 - Change connect.offsets kafka connector error 如何设置kafka-connect连接器和任务的JVM堆大小? - How to set kafka-connect connector and task's JVM heap size? 无法使用 elasticsearch sink 连接器(kafka-connect) - Unable to use elasticsearch sink connector (kafka-connect) 是否可以在 Kubernetes kafka-connect 中启动没有 JSON 的连接器 - Is it possible to start connector without JSON in Kubernetes kafka-connect
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM