Kafka 学习笔记之 Kafka0.11之console-producer/console-consumer:
启动Zookeeper
启动Kafka0.11
创建一个新的Topic:
./kafka-topics.sh --create --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181 --replication-factor 1 --partitions 3 --topic Topic011
查询Topic列表:
./kafka-topics.sh --list --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181
查看Topic详细信息:
./kafka-topics.sh --describe --zookeeper hadoop1:2181,hadoop2:2181,hadoop3:2181 --topic Topic011
建立订阅者console-consumer:(Note:在0.9版本指定的是zookeeper server,0.11变成了broker server)
./kafka-console-consumer.sh --bootstrap-server hadoop1:9092,hadoop2:9092,hadoop3:9092 --topic Topic011
建立发布者console-producer:
./kafka-console-producer.sh --broker-list hadoop1:9092,hadoop2:9092,hadoop3:9092 --topic Topic011
发送消息: