简体   繁体   English

如何重置偏移值重新读取kafka主题

[英]How to reset the offset value to re-read the kafka topic

There is a situation when Consumer1 reads messages from a kafka topic.有一种情况, Consumer1从 kafka 主题读取消息。 When connecting the second Consumer2 with the same groupId , there is a rebalance of partitions.当使用相同的groupId连接第二个Consumer2,会重新平衡分区。 Is it possible to somehow reset the offset , so that after the rebalance process, both Consumers read the topic from the beginning?是否有可能以某种方式重置offset ,以便在重新平衡过程之后,两个消费者都从头开始阅读主题?

I think as per your requirement you can set the offset value as Earliest , so that it can consumed from beginning.我认为根据您的要求,您可以将偏移值设置为Earliest ,以便它可以从一开始就消耗掉。

For more details for offset you can visit this article which explains what value you can set offset value to [https://dzone.com/articles/apache-kafka-consumer-group-offset-retention]有关偏移的更多详细信息,您可以访问这篇文章,该文章解释了您可以将偏移值设置为[https://dzone.com/articles/apache-kafka-consumer-group-offset-retention] 的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kafka与Java:如何重新读取数据 - Kafka with Java: how to re-read data 如何强制Android重新读取GPS位置? - How enforce Android to re-read GPS position? 我们如何手动重置通过 Spring Boot Java 应用程序消耗的 kafka 主题的偏移量? - How can we manually reset the offset of a kafka topic which is consumed through a spring boot java application? 调用IOUtils.copy后如何重新读取InputStream? - How to re-read an InputStream after calling IOUtils.copy? 如何从特定的偏移量中消费一个kafka主题? - how to consume a kafka topic from a specific offset? Java:当我从kafka主题开始读取时,如何从当前偏移量读取 - Java: How to read from current offset when I start reading from a kafka topic 如何在特定偏移量到特定偏移量中使用来自 kafka 主题的数据? - How to consume data from kafka topic in specific offset to specific offset? 无需重启即可重新读取配置 - Re-read configuration without restart 如何读取文件内容,写入outputstream以及重新读取并存储在Java内存中的字符串变量中 - how to read contents of file, write to outputstream and the re-read and Store in a string variable in memory in java 内容更改后如何重新读取文本文件的新内容? - How can I re-read the new contents of a text file after the contents have changed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM