用户工具

站点工具


cmd:kafka

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
cmd:kafka [2020/10/24 14:45] – 创建 ploughcmd:kafka [2021/02/07 13:05] (当前版本) – [topic管理] plough
行 1: 行 1:
 [[https://www.cnblogs.com/xiaodf/p/6093261.html|Kafka Shell基本命令(包括topic的增删改查)]] [[https://www.cnblogs.com/xiaodf/p/6093261.html|Kafka Shell基本命令(包括topic的增删改查)]]
- +===== 启动 ===== 
-=== 创建 topic ===+=== 启动zk ===
 <code> <code>
-bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --topic test_topic --partitions 2 --replication-factor 1+bin/zookeeper-server-start.sh -daemon config/zookeeper.properties
 </code> </code>
- +=== 启动kafka ===
-=== 查看所有 topic 列表 ===+
 <code> <code>
-bin/kafka-topics.sh --zookeeper zookeeper:2181 --list+bin/kafka-server-start.sh  config/server.properties 
 +</code> 
 +===== topic管理 ===== 
 +=== 创建topic === 
 +创建单分区单副本的 topic test 
 +<code> 
 +bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test 
 +</code> 
 +=== 查看 topic 列表 === 
 +<code> 
 +bin/kafka-topics.sh --list --zookeeper localhost:2181
 </code> </code>
- 
 === 查看指定 topic 信息 === === 查看指定 topic 信息 ===
 <code> <code>
-bin/kafka-topics.sh --zookeeper zookeeper:2181 --describe --topic test_topic+bin/kafka-topics.sh --describe --zookeeper localhost:2181 --topic test
 </code> </code>
- +===== 生产与消费 ===== 
-=== 控制台消费 topic 的数据 ===+=== 生产消息 ===
 <code> <code>
-bin/kafka-console-consumer.sh  --zookeeper zookeeper:2181  --topic test_topic --from-beginning+bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test
 </code> </code>
 +=== 消费消息 ===
 +<code>
 +bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning
 +# 如果上面不管用的话
 +bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
 +</code>
 +
cmd/kafka.1603521911.txt.gz · 最后更改: 2020/10/24 14:45 由 plough

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki