Windows Kafka 配置 -> 启动教程

2020-02-15  本文已影响0人  老衲呢

Windows Kafka 启动教程

修改 boker.id 和 log.dirs

进入kafka目录下,新建文件夹 kafka-logs 与文件夹 zk-dir,进入config目录下,打开server.properties

broker.id=1
log.dirs=../kafka-logs

修改 zookeeper.properties

找到 dataDirs,改为

dataDir=../zk-dir

启动 ZooKeeper

使用 powerShell 或 cmd 或 git Bash 打开到安装 kafka 的目录下,黏贴一下命令,执行便可

bin/windows/zookeeper-server-start.bat config/zookeeper.properties

启动 Kafka

重新打开一个 powerShell 或 cmd 或 git Bash,同样 cd 到 kafka 的安装目录下。输入一下命令。

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

启动完成

创建 topic

创建 test 的 topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic merchants-template

查看 topic

bin/windows/kafka-topics.bat --list --zookeeper localhost:2181

启动生产者

bin/windows/kafka-console-producer.bat --broker-list localhost:9092 --topic merchants-template

创建消费者

bin/windows/kafka-console-consumer.bat --bootstrap-server localhost:9092 --topic merchants-template --from-beginning

人若无名,专心练剑!
喜欢的朋友可以留下你的赞!

上一篇下一篇

猜你喜欢

热点阅读