Kafka 1.1.1 release GetOffsetShell uses scala consumer client to fetch offsets. looks like some issue while fetching offsets for a given timestamp. You can try using Kafka 2.0 release GetOffsetShell tool to fetch offstes from 1.1.1 cluster.
On Tue, Oct 2, 2018 at 6:56 PM dhiraj sardana <d.sardana...@gmail.com> wrote: > 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 >