kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Pardi <f.pa...@portavita.eu>
Subject reliable way to count number of messages
Date Mon, 08 Jun 2020 08:42:36 GMT
Hi there,

I have one topic with one partition and i want to know how many messages are there in the
topic.

I noticed that if i run:

kafka-console-consumer --topic mytopic  --bootstrap-server [..]:9092 --from-beginning

[..]
Processed a total of 23626 messages


If I instead run:

 kafka.tools.GetOffsetShell --broker-list [..]:9092 --topic mytopic --time -1

mytopic:0:47252


So the 2 commands return different numbers and the first returns exactly half the amount the
second does.

Why the 2 commands do not return the same amount and which one is right?


kafka-console-consumer --version
5.4.1-ccs (Commit:fd1e543386b47352)

kafka-run-class -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (Zulu 8.38.0.13-CA-linux64) (build 1.8.0_212-b04)
OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-CA-linux64) (build 25.212-b04, mixed mode)

regards,

fabio pardi

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