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

Mac starts local kafka

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

Share

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

Open the terminal and execute the following command

1. zkserver start ----start zk

2. Start kafka

2.1 cd /usr/local/Cellar/kafka/ ---to kafka installation directory

2.2 ls ---Check out the kafka version, for example, 0.11.0.1

2.3 cd 0.11.0.1

2.4 cd bin ---- cd /usr/local/Cellar/kafka/0.11.0.1/bin

2.5 ./ kafka-server-start /usr/local/etc/kafka/server.properties---Execute kafka startup script

4. Creating a topic

./ kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic testTopic

5. View the topic created

./ kafka-topics --list --zookeeper localhost:2181

6. Start the production process (testTopic is the topic name) localhost:9092 To be consistent with the configuration pairs in/usr/local/etc/kafka/server.properties, the configuration may be in the form of ip: port pairs.

./ kafka-console-producer --broker-list localhost:9092 --topic testTopic

7. Start the consuming process localhost:9092 To be consistent with the configuration pair in/usr/local/etc/kafka/server.properties, the configuration may be in the form of ip: port pair.

./ kafka-console-consumer --bootstrap-server localhost:9092 --topic testTopic --from-beginning

Note: kafka-related scripts are all in/usr/local/Cellar/kafka/version number (e.g. 0.11.0.1)/bin file

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