赞
踩
建议对kafka还不了解的小伙伴先看此文章:Kafka入门笔记(一) --kafka概述+kafka集群搭建
bin/kafka-server-start.sh -daemon config/server.propertieds
-daemon: 守护进程
bin/kafka-server-stop.sh
bin/kafka-topics.sh --zookeeper localhost:2181 --list
bin/kafka-topics.sh --zookeeper localhost:2181 --create --replication-factor 3 --partitions 1 --topic first
bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic first
bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic first
注意:
需要server.properties中设置delete.topic.enable=true否则只是标记删除
bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic first --partitions 6
生产者在 first topic 发送消息:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic first
消费 first topic中的消息:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first
从头开始消费 first topic 中的消息:
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --from-beginning --topic first
/bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic first --consumer-property group.id=CONSUMER_GROUP_ID
bin/kafka-consumer-groups.sh --describe --bootstrap-server localhost:9092 --group CONSUMER_GROUP_ID
bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --group CONSUMER_GROUP_ID
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。