kafka3.0常用命令

1、进入kafka的bin目录:先启动内置zookeeper

    执行命令:zookeeper-server-start.sh ../config/zookeeper.properties

    后台运行命令:zookeeper-server-start.sh -daemon ../config/zookeeper.properties

2、启动kafka

    执行命令:./kafka-server-start.sh ../config/server.properties,主义前面 ./ ,不然启动不了。

    后台启动命令:./kafka-server-start.sh -daemon ../config/server.properties

生产命令:
bin/kafka-console-producer.sh --broker-list localhost:9092 --topic frist0401

消费命令:
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic frist0401

查看当前服务器中的所有 topic

bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

创建topic

bin/kafka-topics.sh --bootstrap-server localhost:9092 --create --partitions 1 --replication-factor 1 --topic first0406

3、查看 first 主题的详情

bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic first0406

  4、修改分区数(注意:分区数只能增加,不能减少)

    bin/kafka-topics.sh --bootstrap-server localhost:9092 --alter --topic first --partitions 3

  5、再次查看 first 主题的详情

    bin/kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic first

  6、删除 topic

    bin/kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic first

posted @   技术研究与问题解决  阅读(118)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
历史上的今天:
2020-02-18 10.pandas的替换和部分替换(replace)
2020-02-18 pandas中.value_counts()的用法
点击右上角即可分享
微信分享提示