当前位置: 移动技术网 > IT编程>软件设计>架构 > kafka cmd首个单机例子配置

kafka cmd首个单机例子配置

2019年08月26日  | 移动技术网IT编程  | 我要评论

下载地址:       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

 

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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网