启动zookeeper
./bin/zookeeper-server-start.sh config/zookeeper.properties &
启动kafka
./bin/kafka-server-start.sh config/server.properties &
创建名为 test的主题
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
查看主题
./bin/kafka-topics.sh --list --zookeeper localhost:2181
发送消息到test主题
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
接受test主题产生的消息
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
删除test主题
./bin/kafka-topics.sh --delete --zookeeper localhost:9092 --topic test