启动:kafka bin/kafka-server-start.sh config/server.properties
停止:kafka bin/kafka-server-stop.sh
kafka中也可以启动和停止zookeeper 启动:zookeeper bin/zookeeper-server-start.sh config/zookeeper.properties 停止:zookeeper bin/zookeeper-server-stop.sh
创建:topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --topic test --replication-factor 1 --partitions 1
查看当前的:topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
描述topic
bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic replicated-topic(自己定义的topic)
生产者:producer
bin/kafka-console-producer.sh --broker-list 192.168.16.100:9092 --topic my-replicated-topic(自己定义的topic)
消费者:consumer
bin/kafka-console-consumer.sh --zookeeper 192.168.16.100:2181 --topic test --from-beginnin
删除
bin/kafka-topics.sh --delete --zookeeper 192.168.16.100:2181 --topic max delete.topic.enable=true
(delete.topic.enable=true这句话加上去代表真的删除,不加的话,再一次查询topic,还是有记录,并出现 - marked for deletion,所以加上elete.topic.enable=true,要删除的topic就消失了)