Created
October 9, 2017 06:36
-
-
Save clarksun/540336aff2b246177a1bc7b4aee977a2 to your computer and use it in GitHub Desktop.
get kafka topic message count
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kafka-run-class kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic xxx --time -1 --offsets 1 | awk -F ':' '{sum += $3} END {print sum}' |
How can you do this whilst still being able to pass in credentials?
ubuntu@prod-kafka-1:/opt/kafka/kafka_2.12-2.2.0$ bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic topic_1 --time -1 --offsets 1 | awk -F ":" '{sum += $3} END {print sum}'
6075
ubuntu@prod-kafka-1:/opt/kafka/kafka_2.12-2.2.0$ bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topic_1 --property print.key=true --property key.separator="-" --from-beginning
^CProcessed a total of 0 messages
ubuntu@prod-kafka-1:/opt/kafka/kafka_2.12-2.2.0$
Apparently, this is not correct and it gives wrong information as seen above.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!
Just a comment, parameter
--offsets
(also--max-wait-ms
) is "DEPRECATED AND IGNORED"My current CLI version is: