I'm looking for a Kafka command that shows all of the topics and offsets of partitions. If it's dynamically would be perfect. Right now I'm using java code to see these information, but it's very inconvenient.
标签:
apache-kafka
相关问题
- Delete Messages from a Topic in Apache Kafka
- Serializing a serialized Thrift struct to Kafka in
- Kafka broker shutdown while cleaning up log files
- Getting : Error importing Spark Modules : No modul
- How to transform all timestamp fields when using K
相关文章
- Kafka doesn't delete old messages in topics
- Kafka + Spark Streaming: constant delay of 1 secon
- Spring Kafka Template implementaion example for se
- How to fetch recent messages from Kafka topic
- Determine the Kafka-Client compatibility with kafk
- Kafka to Google Cloud Platform Dataflow ingestion
- Kafka Producer Metrics
- Spark Structured Streaming + Kafka Integration: Mi
Kafka ships with some tools you can use to accomplish this.
List topics:
List partitions and offsets:
Update for 0.9 (and higher) consumer APIs
If you're using the new apis, there's a new tool you can use:
kafka-consumer-groups.sh
.We're using Kafka 2.11 and make use of this tool -
kafka-consumer-groups
.For example:
Random Tip
NOTE: We use an alias that overloads
kafka-consumer-groups
like so in our/etc/profile.d/kafka.sh
:You might want to try kt. It's also quite faster than the bundled
kafka-topics
.This is the current most complete info description you can get out of a topic with kt:
kt topic -brokers localhost:9092 -filter my_topic_name -partitions -leaders -replicas
It also outputs as JSON, so you can pipe it to
jq
for further flexibility.