Kafka命令清单(转发)

一、队列常用命令

#创建topics
$ ./kafka-topics.sh --create --zookeeper chenx02:2181 --replication-factor 1 --partitions 1 --topic test

#查看队列列表
$ ./kafka-topics.sh --list --zookeeper chenx02:2181

#查看队列明细
$ ./kafka-topics.sh --describe --zookeeper chenx02:2181 --topic test

#修改(test)队列参数
$ ./kafka-topics.sh --zookeeper chenx02:2181 --partition 3 --topic test --alter

#创建多副本的队列
$ ./kafka-topics.sh --create --zookeeper chenx02:2181 --replication-factor 3 --partitions 4 --topic test_kafka 

#删除kafka的队列[注意需要重启kafka集群] 
$ ./kafka-run-class.sh kafka.admin.DeleteTopicCommand --topic test_kafka --zookeeper chenx02:2181

#查看不可用的分区 
$./kafka-topics.sh --describe --unavailable-partitions --zookeeper chenx02:2181 --topic  test_kafka

#发送消息 
$ ./kafka-console-producer.sh --broker-list chenx02:9092 --topic test
#消费消息 
$ ./kafka-console-consumer.sh --zookeeper chenx02:2181 --topic test --from-beginning
posted @ 2020-08-31 16:22  PanPan003  阅读(203)  评论(0编辑  收藏  举报