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

 

在生产者里输入内容,消费者就打印出相应内容

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值