windwos 单机 kafka 部署(方便于本地测试)

下载地址 https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.4.0/kafka_2.11-2.4.0.tgz

1.解压到本地目录 我的路径是 C:Mysoftware2Devkafka_2.11-2.4.0

2.启动 kafka 服务 win+r 打开cmd cd C:Mysoftware2Devkafka_2.11-2.4.0 1 2.启动zookeeper 服务

binwindowszookeeper-server-start.bat configzookeeper.properties 1 3.启动kafka 服务

binwindowskafka-server-start.bat configserver.properties 1 创建Topic 1.创建Topic,名称为 test

binwindowskafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test 1 查看已创建的 Topic

binwindowskafka-topics.bat --list --zookeeper localhost:2181 1 测试 生产者

binwindowskafka-console-producer.bat --broker-list localhost:9092 --topic test 1 消费者

binwindowskafka-console-consumer.bat --bootstrap-server 127.0.0.1:9092 --topic test--from-beginning 1 以上命令非后台启动,需要单独开启一个cmd 命令行窗口

########################################### 阿里云部署单机版 需要添加外网访问 vim config/server.properties broker.id=0

port=9092

host.name=阿里云内网地址

advertised.host.name=阿里云外网映射地址

经验分享 程序员 微信小程序 职场和发展