Discussion:
Does high level consumer support setting offset
Yonghui Zhao
2014-02-27 16:25:29 UTC
Permalink
Hi£¬

In kafka 0.8, does high level consumer support setting offset?

Our service reads kafka data but won't flush the data immediately, so if
restarted the data in memory will be lost. We want to reset kafka consumer
offset to an old offset.

If the consumer group has only 1 machine, we can record all partition
offset for our topic in disk. Does the high level consumer support
setting offset in zk to the recorded offset?
Neha Narkhede
2014-02-27 17:24:11 UTC
Permalink
Currently, the only way to rewind the high level consumer to a different
offset is to first shutdown all instances of the consumer, update zookeeper
with the desired offsets and then restart the consumer. We are addressing
this in the new consumer APIs for Kafka 0.9. If you can review the proposal
<http://mail-archives.apache.org/mod_mbox/kafka-users/201402.mbox/%3CCAOG_4QYBHwyi0xN=HL1FpnRTkVfJZX14uJFntfT3nn_Mw3+XgQ-JsoAwUIsXosN+***@public.gmane.org%3E>on
this thread, that will be appreciated.

Thanks,
Neha
Post by Yonghui Zhao
Hi
In kafka 0.8, does high level consumer support setting offset?
Our service reads kafka data but won't flush the data immediately, so if
restarted the data in memory will be lost. We want to reset kafka consumer
offset to an old offset.
If the consumer group has only 1 machine, we can record all partition
offset for our topic in disk. Does the high level consumer support
setting offset in zk to the recorded offset?
Guozhang Wang
2014-02-27 17:31:57 UTC
Permalink
Hello Yonghui,

In 0.8 high level consumer does not support setting offsets directly.
However, you can use this tool to manually set the offset in ZK before you
re-start the consumer to change the starting offset:

bin/kafka-run-class.sh kafka.tools.UpdateOffsetsInZK

Guozhang
Post by Yonghui Zhao
Hi
In kafka 0.8, does high level consumer support setting offset?
Our service reads kafka data but won't flush the data immediately, so if
restarted the data in memory will be lost. We want to reset kafka consumer
offset to an old offset.
If the consumer group has only 1 machine, we can record all partition
offset for our topic in disk. Does the high level consumer support
setting offset in zk to the recorded offset?
--
-- Guozhang
Loading...