======================命令======================
启动zookeeper server
bin/zookeeper-server-start.sh config/zookeeper.properties &
&是为了能退出命令行
启动kafka server
bin/kafka-server-start.sh config/server.properties &
停止kafka server
bin/kafka-server-stop.sh
停止zookeeper server
bin/zookeeper-server-stop.sh
======================单broker测试======================
运行producer
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
早版本的Kafka,--broker-list localhost:9092需改为--zookeeper localhost:2181
运行consumer
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
在producer端输入字符串并回车,查看consumer端是否显示。