启动zookeeper bin/zookeeper-server-start.sh config/zookeeper.properties & 启动kafka bin/kafka-server-start.sh config/server.properties & 停止kafka bin/kafka-server-stop.sh 停止zookeeper bin/zookeeper-server-stop.sh
创建topic bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test 展示topic bin/kafka-topics.sh --list --zookeeper localhost:2181 描述topic bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic my-replicated-topic 生产者: bin/kafka-console-producer.sh --broker-list 130.51.23.95:9092 --topic my-replicated-topic 消费者: bin/kafka-console-consumer.sh --zookeeper 130.51.23.95:2181 --topic test --from-beginnin
删除topic
bin/kafka-topics.sh --delete --zookeeper 130.51.23.95:2181 --topic topicname
删除topic中存储的内容
在config/server.properties中找到如下的位置
删除log.dirs指定的文件目录,然后重新启动就可以了