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

What are the commonly used commands in the new version of 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 will explain in detail what commands are commonly used in the new version of kafka. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1 / the command to list topic is:

Kafka-topics.sh-- zookeeper 10.211.55.11 list 2181 Magazine 10.211.55.12 list

2 / the command to delete topic is:

Kafka-topics.sh-- delete-- zookeeper 10.211.55.11 zookeeper 2181 Magazine 10.211.55.12 Fraser 2181 Magi 10.211.55.13 Fringe 2181 Greater Kafkaghi-topic topic-majihui

3 / create the topic command as follows:

Kafka-topics.sh-- create-- zookeeper 10.211.55.11 zookeeper 2181 zookeeper 10.211.55.12 zookeeper 10.211.55.12 zookeeper 10.211.55.13 partitions 30-- replication-factor 3-- topic topic-by-majihui

4 / View the details of topic, including the assigned location of partition and repilce

Kafka-topics.sh-- zookeeper 10.211.55.11 describe-- topic topic-by-majihui

5 / create a producer terminal on one of the broker

Kafka-console-producer.sh-- topic topic-by-majihui-- broker-list kafka01-55-11 broker-list kafka01 9092 Magazine Kafka02-55-12 Fraser 9092

Next, you need to verify that the verification message production success command is as follows:

Kafka-run-class.sh kafka.tools.GetOffsetShell-- broker-list 10.211.55.11-- topic topic-by-majihui-- time-1

6 / Consumer of startup terminal / / Summary:-from-beginning parameter indicates that if data is consumed from the beginning, both old and new data will be consumed, while without this parameter, only new data will be consumed

Kafka-console-consumer.sh-- bootstrap-server kafka01-55-11 topic topic-by-majihui 9092 topic topic-by-majihui-- from-beginning

/ / start a new consumer so that he belongs to a consumer group new-consumer-majihui

Kafka-console-consumer.sh-- bootstrap-server 10.211.55.11 consumer-property group.id=new-consumer-majihui-- consumer-property client.id=new-consumer-cl-- topic topic-by-majihui

When you perform the list at this point, the consumer will see:

[hadoop@kafka03-55-13] $kafka-consumer-groups.sh-- bootstrap-server kafka01-55-11 list 9092 bootstrap-server kafka01 02-55-12 purl 9092 list 03-55-13

New-consumer-majihui

7 / list consumer groups / / see which consumer groups are consuming messages and how to create a consumer group?

Kafka-consumer-groups.sh-- bootstrap-server kafka01-55-11 list 9092 list

Kafka-consumer-groups.sh-- bootstrap-server tencent-kafka01-39-110 list

8 / View the consumption progress and consumption details of a consumption group

Kafka-consumer-groups.sh-- bootstrap-server kafka01-55-11 describe 9092 describe-- group console-consumer-120

/ / this console-consumer-120 is found by the above viewing consumer group.

9 / View the maximum (minimum) value of a partition offset in topic

Kafka-run-class.sh kafka.tools.GetOffsetShell-- topic topic-by-majihui-- time-1-- broker-list kafka01-55-11 time 9092 partitions 02-55-12 time 9092-- Kafka03-55-13

Note: a time of-1 indicates the maximum value and a time of-2 indicates the minimum value.

10 / View the specific contents of a kafka partition log, index and log files

Kafka-run-class.sh kafka.tools.DumpLogSegments-files / tmp/kafka-logs/firsttopic-0/00000000000000000000.log-print-data-log > 00000000000000000000.txt0

11/kafka-run-class.sh kafka.tools.DumpLogSegments-files / data/kafka/kafka-logs/topic-by-majihui-9/00000000000000000000.index-print-data-log > 00000000000000000000index.txt

12 / balanced leader

Kafka-preferred-replica-election.sh-- bootstrap-server kafka01-55-11 9092 Magazine Kafka02-55-12 Fraser 9092 Kafka03-55-13 Vol 9092

This is the end of this article on "what are the common commands in the new version of kafka?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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