1、启动zookeeper(建议命令前加上nohup)
> bin/zookeeper-server-start.sh config/zookeeper.properties &
2、启动kafka(建议命令前加上nohup)
> bin/kafka-server-start.sh config/server.properties &
3、创建主题test-指定分区
>bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test
4、查看都有那些主题
>bin/kafka-topics.sh --list --zookeeper localhost:2181
5、监控test主题消息(消费)
>bin/kafka-console-consumer.sh --zookeeper 127.0.0.1:2181 --topic test --from-beginning
6、console版生产者
>bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test