kafka安装

1.下载

http://kafka.apache.org/downloads

2.解压&启动

tar -xzf  kafka_2.11-2.3.0.tgz
cd kafka_2.11-2.3.0
./bin/zookeeper-server-start.sh config/zookeeper.properties  &  //zk
./bin/kafka-server-start.sh config/server.properties &    //kafka

3.创建主题

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
bin/kafka-topics.sh --list --zookeeper localhost:2181
>test

Ps 除手工创建topic外,你也可以配置你的broker,当发布一个不存在的topic时自动创建topic。

kafka项目启动报错:可查看与Spring-Boot的版本是否一致(匹配)

如果在服务器上安装要注意防火墙或安全策略有没有放开对应的端口

查看所有topic

./kafka-topics.sh --list --zookeeper localhost:2181

  

查看某个topic具体信息

./kafka-topics.sh --describe --zookeeper localhost:2181 --topic test

  

删除某一个topic

./kafka-topics.sh --delete --zookeeper  localhost:2181 --topic test

参考:

https://www.orchome.com/6

原文地址:https://www.cnblogs.com/julian-chang/p/11970563.html