In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what kafka commands are commonly used, the article is very detailed, has a certain reference value, interested friends must read it!
Kafka is a distributed, partitioned, multi-replica, multi-subscriber, distributed log system based on zookeeper coordination (which can also be used as a MQ system), which can be used for web/nginx log, access log, message service and so on.
1. Start the kafka service
Bin/kafka-server-start.sh config/server.properties &
2. Stop the kafka service
. / kafka-server-stop.sh
3. Check all the topics
. / kafka-topics.sh-list-zookeeper localhost:9092
4. View the details of all topics
. / kafka-topics.sh-zookeeper localhost:2181-describe
5. List the details of the specified topic
. / kafka-topics.sh-- zookeeper localhost:2181-- describe-- topic demo
6. Delete a topic
. / kafka-topics.sh-- zookeeper localhost:2181-- delete-- topic test
7. Create a topic called test, which has two partitions, each with 3 copies
. / kafka-topics.sh-- zookeeper localhost:2181-- create-- topic test-- replication-factor 3-- partitions 2
8. Test kafka to send and receive messages (start two terminals)
# send a message (note that the port number is the port number in the configuration file). / kafka-console-producer.sh-- broker-list localhost:9092-- topic test# consumption message (maybe the port number is the same as the configuration file Or consistent with the sending port). / kafka-console-consumer.sh-- bootstrap-server localhost:9092-- topic test-- from-beginning # added-- from-beginning consumes all messages again. / kafka-console-consumer.sh-- bootstrap-server localhost:9092-- topic test # does not add-- from-beginning starts consumption from the latest message.
9. Check the number of messages corresponding to a topic
. / kafka-run-class.sh kafka.tools.GetOffsetShell-- broker-list localhost:9092-- topic test-- time-1
10. Show all consumers
. / kafka-consumer-groups.sh-bootstrap-server localhost:9092-list
11. Get the offset of the group of the topic (console-consumer-63307) that is being consumed
. / kafka-consumer-groups.sh-- describe-- group console-consumer-63307-- bootstrap-server localhost:9092
11. Show consumers
. / kafka-consumer-groups.sh-- bootstrap-server localhost:9092-- list above are all the contents of this article entitled "what are the common commands in 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.