1. wget https://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.12.tar.gz
tar -zxvf zookeeper-3.4.12.tar.gz 解压
2. cd zookeeper-3.4.12
cp -rf conf/zoo_sample.cfg conf/zoo.cfg
vim conf/zoo.cfg
修改snapshot存储地址
3. sh bin/zkServer.sh start 启动zookeeper
4.启动kafka
sh bin/kafka-server-start.sh config/server.properties
5.创建topic
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目录文件