kafka linux客户端,kafka linux 客户端操作命令
生產(chǎn)命令
消費命令
topic刪除命令
topic描述命令
在linux運行kafka? ? bin/kafka-server-start ../config/server.properties
生產(chǎn)命令
1.創(chuàng)建一個topic
KAFKA_HOME/bin/kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic test
2. 查看topic列表
bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --list
3.向topic發(fā)送數(shù)據(jù)
bin/kafka-console-producer.sh --broker-list 127.0.0.1:9092 --topic test
test message 1
test message 2
消費命令
3.從topic讀取數(shù)據(jù)
bin/kafka-console-consumer.sh --bootstrap-server 127.0.0.1:9092 --topic test --from-beginning
4.查看kafka消費組的列表(0.9版本以上)
bin/kafka-consumer-groups.sh --new-consumer --bootstrap-server 127.0.0.1:9092 --list
5.修改讀取offset到當前的位置
/bin/kafka-run-class.sh kafka.tools.UpdateOffsetsInZK latest test.properties test
6.查看消費情況
bin/kafka-consumer-groups.sh --new-consumer --bootstrap-server 127.0.0.1:9092 --describe --group test
Group : 消費者組
Topic : topic的名字
Pid : partition的ID
Offset : kafka消費者在對應分區(qū)上已經(jīng)消費的消息數(shù)【位置】
logSize : 已經(jīng)寫到該分區(qū)的消息數(shù)【位置】
Lag : 還有多少消息未讀取(Lag = logSize - Offset)
Owner : 分區(qū)創(chuàng)建在哪個broker
原文鏈接:https://blog.csdn.net/wo1769815/article/details/100891277
topic刪除命令
7.刪除主題操作
bin/kafka-topics.sh --delete --zookeeper 127.0.0.1:2181 --topic test
topic描述命令
8.查看topic描述
bin/kafka-topics.sh --describe --zookeeper 127.0.0.1:2181 --topic test
總結
以上是生活随笔為你收集整理的kafka linux客户端,kafka linux 客户端操作命令的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 主nginx linux,Linux-实
- 下一篇: Linux常用编辑器使用:vi、vim、