将消费者偏移量重置为 Kafka Streams 的开头 [英] Reset consumer offset to the beginning from Kafka Streams

查看:49
本文介绍了将消费者偏移量重置为 Kafka Streams 的开头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Kafka 流,并希望将一些消费者偏移量从 Java 重置到开头.KafkaConsumer.seekToBeginning(...) 听起来是正确的做法,但我使用 Kafka Streams:

I am using Kafka streams and want to reset some consumer offset from Java to the beginning. KafkaConsumer.seekToBeginning(...) sounds like the right thing to do, but I work with Kafka Streams:

KafkaStreams streams = new KafkaStreams(builder, props);
...
streams.start();

我想根据我定义的具体流管道,这会在幕后创建几个消费者.我可以访问那些吗?或者是否有其他方式以编程方式重置偏移量?

I guess that depending on the concrete streams pipeline I define this would create several consumers under the hood. Can I get access to those? Or is there some other way to reset offsets programmatically?

推荐答案

由于您使用的是 Kafka Streams,因此您不仅要重置消费者偏移量,还要重置 Streams 内部状态存储.

Since you are using Kafka Streams you will want to reset not only the consumer offsets but also the Streams internal state store.

幸运的是,Kafka 提供了一个 Streams 应用程序重置工具.

Fortunately there is a Streams Application Reset Tool provided with Kafka.

参见 https://cwiki.apache.org/confluence/display/KAFKA/Kafka+Streams+Application+Reset+Tool

这篇关于将消费者偏移量重置为 Kafka Streams 的开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆