Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to query topic list and messages under topic by kafka

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces kafka how to query the topic list and topic messages, the article is very detailed, has a certain reference value, interested friends must read it!

When using Kafka, you often come across the need to check whether the topic is created, or to view the data under the topic.

At first, if you want to go directly to the visualization tool to check it, you will find Kafka tool and find that the environment with less linked data is really easier to use, but if there is more data under topic or topic, it will be stuck and cannot be opened.

Simple use of Kafka tool

First, go to the official website to download Kafka tool: https://www.kafkatool.com/

Brainless next step for installation. Create a new link after the installation is complete

Because the data is all byte in Kafka, it is necessary to configure byte to string so that it can be viewed more easily.

In tools-- > settings-- > Topics

Then select the topic you want to view and configure key and message as string in properties

Then go to the partition under topic and click the green query button to view it.

If the amount of data is small, you can use this tool to view it, but if there is too much data, it will be stuck directly.

Use the Kafka command script to view

Since our company's Kafka is deployed in docker, we need to enter the Kafka container first, and then go to the opt/kafka/bin/ directory, where the Kafka script commands are located.

Check the kafka topic list kafka-topics.sh-list-- zookeeper zookeeper address: the port starts from scratch to view the data under kafka topic kafka-console-consumer.sh-- bootstrap-server localhost:9092-- topic topic_name-- from-beginning to view the data under topic by offset kafka-console-consumer.sh-- bootstrap-server localhost:9092-- topic topic_name-- offset latest-- partition address-- offset setting offset latest represents the last, you can set the range If you don't set the end, the default is to query latest (finally) #-when partition sets a partition to use offset query, you must set up a partition to query and clear all messages under Kafka topic kafka-topics.sh-- zookeeper zookeeper address: Port-- delete-- topic topic_name above is all the contents of the article "how to query topic list and messages under topic by kafka". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report