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

 



posted @ 2019-09-11 00:18  DaBai的黑屋  阅读(302)  评论(0编辑  收藏  举报
Live2D