Kafka常用命令
●常用命令
#启动kafka
/export/servers/kafka/bin/kafka-server-start.sh -daemon /export/servers/kafka/config/server.properties
#停止kafka
/export/servers/kafka/bin/kafka-server-stop.sh
#查看topic信息
/export/servers/kafka/bin/kafka-topics.sh --list --zookeeper node01:2181
#创建topic
/export/servers/kafka/bin/kafka-topics.sh --create --zookeeper node01:2181 --replication-factor 3 --partitions 3 --topic mytest
#查看某个topic信息
/export/servers/kafka/bin/kafka-topics.sh --describe --zookeeper node01:2181 --topic mytest
#删除topic
/export/servers/kafka/bin/kafka-topics.sh --zookeeper node01:2181 --delete --topic mytest
#启动生产者
/export/servers/kafka/bin/kafka-console-producer.sh --broker-list node01:9092,node01:9092,node01:9092 --topic spark_kafka
#启动消费者
/export/servers/kafka/bin/kafka-console-consumer.sh --zookeeper node01:2181 --topic spark_kafka--from-beginning
# 消费者连接到borker的地址
/export/servers/kafka/bin/kafka-console-consumer.sh --bootstrap-server node01:9092,node02:9092,node03:9092 --topic spark_kafka --from-beginning
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。