kafka cmd首個單機例子配置

下載地址:http://kafka.apache.org/downloads       http://mirror.bit.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz

 

zookeeper.properties修改dataDir

dataDir=G:\zookeeper-3.5.5\data
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=0

server.properties修改log.dirs

############################# Log Basics #############################

# A comma separated list of directories under which to store log files
log.dirs=G:\kafka\logs

 

運行zookeeper命令

zkserver

 

進入cd G:\kafka\bin\windows

 

啓動服務:

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

創建實例

kafka-topics.bat --create --zookeeper localhost:2181 --repl
ication-factor 1 --partitions 1 --topic testDemo

 

生產者

kafka-console-producer.bat --broker-list localhost:9092 --t
opic testDemo

 

 

消費者

kafka-console-consumer.bat --bootstrap-server localhost:909
2 --topic testDemo --from-beginning

 

在生產者裏輸入內容,消費者就打印出相應內容

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