kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dhiraj sardana <d.sardana...@gmail.com>
Subject Getting topic offset for given timestamp | GetOffsetShell is not working|KAFKA-1.1.1
Date Tue, 02 Oct 2018 13:26:09 GMT
Hello All,

I wanted to check offset for given timestamp via *shell command*, so i
checked 'GetOffsetShell' for that purpose, but its not working properly.

bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list
localhost:9092 --topic test_kafka --time *1538470622047*

test_kafka:0:

While It's working fine for -1/-2 (latest/begninning) time parameters:
test_kafka:0:28
test_kafka:0:0

I checked in another tab,  there are so many messages before/after this
timestamp(i tried different other timestamps as well).
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic
test_kafka --property print.timestamp=true --from-beginning
....
CreateTime:1538470621404    asdas
CreateTime:*1538470622047*    asdasd
CreateTime:1538470622824    asdasd

Also, for same timestamp, if i try consumer's JAVA API(
*consumer.offsetsForTimes(topicPartitionTimeMap)*), it worked fine and
returned the offset.

So, if any pointers to fix 'GetOffsetShell'(if i am missing something)
Or to run above working 'offsetsForTimes' API via shell command
Or any other way to get offset for given timestamp from shell commands?

Thanks for reading and helping!

Regards,
Dhiraj

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message