1. wget https://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.12.tar.gzapache
tar -zxvf zookeeper-3.4.12.tar.gz 解壓vim
2. cd zookeeper-3.4.12ruby
cp -rf conf/zoo_sample.cfg conf/zoo.cfg
code
vim conf/zoo.cfg
server
修改snapshot存儲地址get
3. sh bin/zkServer.sh start 啓動zookeeper kafka
4.啓動kafkait
sh bin/kafka-server-start.sh config/server.propertiesio
5.建立topicconsole
sh bin/kafka-topics.sh --create --topic testTopic --replication-factor 1 --partitions 1 --zookeeper localhost:2181
6.列出topic
sh bin/kafka-topics.sh --list --zookeeper localhost:2181
7. 列出topic下的消息
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic testTopic --from-beginning
8. 刪除某個topic下的消息
查看消息存儲位置,以下:
# A comma seperated list of directories under which to store log files
log.dirs=/data/kafka/logs-1
刪除指定topic目錄文件