CentOS7安裝Kafka2.6.0

1:下載

wget https://mirror.bit.edu.cn/apache/kafka/2.6.0/kafka_2.12-2.6.0.tgz

點擊前往官網

2:解壓

tar -zxvf kafka_2.12-2.6.0.tgz

這是解壓後的文件

3:啓動ZooKeeper

https://www.cnblogs.com/zgq7/p/13794504.html

4:啓動Kafka

切換到bin目錄下:

執行:

./kafka-server-start.sh ../config/server.properties

守護進程啓動方式:

nohup ./kafka-server-start.sh ../config/server.properties >/application/kafka/log 2>&1 &

看到輸出以下日誌說明啓動成功

再看端口

關閉Kafka
./kafka-server-stop.sh

5:命令介紹

1:創建topic
./kafka-topics.sh --create --topic test --bootstrap-server localhost:9092

2:查看topic列表
./kafka-topics.sh --list --bootstrap-server localhost:9092

3:刪除topic
./kafka-topics.sh --delete --topic test --bootstrap-server localhost:9092

4:produce產生消息
./kafka-console-producer.sh --topic test --bootstrap-server localhost:9092

5:consumer消費消息
./kafka-console-consumer.sh --topic test --from-beginning --bootstrap-server localhost:9092

官方技術文檔地址:http://kafka.apache.org/documentation.html#quickstart
本文博客參考地址:https://www.mtyun.com/library/how-to-install-kafka-on-centos7

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章