1、查看topic列表:
bin/kafka-topics.sh --list --zookeeper localhost:2181
2、查看topic详情:
bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic etl_topic
0.9:bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic alarm_topic
3、消费消息:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic etl_topic
0.9: bin/kafka-console-consumer.sh --zookeeper 192.168.100.18:2181 --topic winskyne-modify-stake-topic --from-beginning
4、生产消息
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic etl_topic
0.9: bin/kafka-console-producer.sh --broker-list 192.168.100.18:9092 --topic winskyne-modify-stake-topic
5、创建topic,1个副本,10个分区的示例:
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 4 --topic etl_topic
6、修改topic,修改为10个分区示例:
bin/kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic etl_topic --partitions 10
0.9:bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic alarm_topic --partitions 2
注意:本文归作者所有,未经作者允许,不得转载