Kafka常用命令

导读:本篇文章讲解 Kafka常用命令,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

1.启动服务器

bin/kafka-server-start.sh config/server.properties

2.关闭服务器

bin/kafka-server-stop.sh config/server.properties

3.创建主题

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

这里创建了一个分区一个副本的主题test

4.查看所有主题

bin/kafka-topics.sh --list --zookeeper localhost:2181

5.启动生产者

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

6.启动消费者

bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning

7.查看队列情况

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group group1

group1是消费者的groupId

8.描述主题命令

bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test

9.删除主题

https://blog.csdn.net/unionibm/article/details/52575146

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由半码博客整理,本文链接:https://www.bmabk.com/index.php/post/13268.html

(0)
小半的头像小半

相关推荐

半码博客——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!