简体   繁体   English

将Kafka主题的线索设置为-1

[英]Setting the leads of the Kafka topic to -1

I am consuming a kfka topic on the cluster using Spark streaming. 我正在使用Spark流在集群上使用kfka主题。 I would restrat my streaming application and would like to read the topic mnessages again. 我将重新启动流应用程序,并想再次阅读主题。

Is there a way to reset the kafka topic leads on the cluster? 有没有办法重置集群上的kafka主题线索?

when I describe the topics i get bellow description: 当我描述主题时,我得到以下描述:

Topic:mahditest PartitionCount:3        ReplicationFactor:2     Configs:
        Topic: mahditest        Partition: 0    Leader: 1020    Replicas: 1020,1019     Isr: 1020,1019

but I need to resent leads to -1 for each topic so I can re-read the messages. 但我需要针对每个主题将潜在客户的响应数设为-1,这样我才能重新阅读邮件。

Depends on where you are storing the offsets but If you are storing them in Kafka using the new consumer API then in Kafka 0.11 you can reset any Kafka consumer's offsets (stored in __consumer_offsets topic) if you run 取决于您存储偏移的位置,但是如果您使用新的使用者API将其存储在Kafka中,则在Kafka 0.11中,如果运行,则可以重置任何Kafka使用者的偏移(存储在__consumer_offsets主题中)

$ kafka-consumer-groups.sh --bootstrap-server localhost:9092 --topic mahditest --group yourconsumer --reset-offsets --to-earliest --execute $ kafka-consumer-groups.sh --bootstrap-server localhost:9092 --topic mahditest --group yourconsumer --reset-offsets --toest最早--execute

You should shut down all consumers in the group before running the reset offsets command 您应该在运行reset offsets命令之前关闭组中的所有使用者。

The 0.11 version of this command should also work to reset offsets on a 0.10.2 cluster 此命令的0.11版本也应该可以在0.10.2集群上重置偏移量

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM