标签:
1、下载kafka
https://www.apache.org/dyn/closer.cgi?path=/kafka/0.8.2.0/kafka_2.10-0.8.2.0.tgz
tar -xzf kafka_2.10-0.8.2.0.tgz
cd kafka_2.10-0.8.2.0
2、启动服务
启动zookeeper服务
启动zookeeper服务 bin/zookeeper-server-start.sh config/zookeeper.properties
启动kafka服务 bin/kafka-server-start.sh config/server.properties
3、创建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
4、生产者
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
5、消费者
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
标签:
原文地址:http://my.oschina.net/internetafei/blog/398196