1.启动zookeeper
kafka依赖于zookeeper,需要先启动zookeeper。
进入kafka解压目录后,
linux:
./bin/zookeeper-server-start.sh ./config/zookeeper.properties
windows:
.inwindowszookeeper-server-start.bat .configzookeeper.properties
2. 启动kafka
Linux:
./bin/kafka-server-start.sh ./config/server.properties
windows:
.inwindowskafka-server-start.bat .configserver.properties
3.创建主题
Linux:
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic topic_name
windows:
.inwindowskafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic topic_name
4.查看主题列表
Linux:
./bin/kafka-topics.sh --list --zookeeper localhost:2181
windows:
.inwindowskafka-topics.bat --list --zookeeper localhost:2181
更完善的参考博客:https://blog.csdn.net/puhanjie/article/details/106498803