-
启动zookeeper
bin/zookeeper-server-start.sh config/zookeeper.properties &
-
启动kafka
bin/kafka-server-start.sh config/server.properties &
-
停止kafka
bin/kafka-server-stop.sh
-
停止zookeeper
bin/zookeeper-server-stop.sh
-
创建topic
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test --if-not-exists
-
展示topic
bin/kafka-topics.sh --list --zookeeper localhost:2181
-
描述topic
bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic my-replicated-topic
-
生产者:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic my-replicated-topic
-
消费者:
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginnin
-
查询offset:
./kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --broker-info --group 0 --topic topic_name --zookeeper localhost:2181/kafka
-
删除topic
./bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic topic_name
kafka命令
最新推荐文章于 2024-09-13 11:18:04 发布