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 > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to implement the basic operation of Kafka. Many people may not know much about it. In order to let you know more, Xiaobian summarized the following contents for you. I hope you can gain something according to this article.
Topic Topics
When kafka data is persisted, in order to distinguish different business topics, the concept of topic is designed, similar to database name, database has several data tables. Different types of message data are classified according to certain rules, and finally the same type of service data is stored under the same topic.
Create topic automatically
Themes are automatically created with the auto.create.topocs.enable attribute, which defaults to true. When producer item kafk sends a topic that doesn't exist, kafka creates a topic with default configuration coefficients. The default partition values are controlled by num.partitions, and the default replication factor is controlled by default.replication.factor. The specific configuration file is in the current kafka config/server.properties
manually create
The specific command is as follows, the subject name is topic-test, because it is the development environment to build partitions and copy partitions are 1
$ kafka-topics.sh --zookeeper localhost: 2181/kafka --create --topic topic-test --replication-factor 1 --partitions 1Created topic "topic-test".
--topic Definition topic name
--replication-factor defines the number of copies
--partitions Defines the number of partitions
View topic
View all topics
$kafka-topics.sh --list -zookeeper localhost:2181__consumer_offsetstopic-test
View topic details
$kafka-topics.sh--zookeeper localhost:2181 --describe --topic topic-testTopic:test PartitionCount:1 ReplicationFactor:1 Configurations: Topic: test Partition: 0 Leader: 0 Replicas: 0 Isr: 0 Send/receive messages $kafka-console-producer.sh--broker-localhost:9092 --topic topic-test>hello kafka>hello worldkafka-console-consumer.sh--bootstrap-server localhost:9092 --from-beginning --topic topic-testhello world After reading the above, do you have any further understanding of how to perform basic Kafka operations? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
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.