kafka運維常用命令

2021-10-09 04:08:12 字數 3217 閱讀 5711

kafka運維常用命令

列出所有的topic

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

檢視 topic資訊

./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic topicname

./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic __consumer_offsets

./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic kafka_demo_test_topic

檢視所有的group

./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 localhost:2181 --list

檢視消費情況

./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group kafkademo_test_group

kafka-consumer-groups.sh

老版本 消費元資料存在zk上 使用 --zookeeper localhost:2181

新版本 使用 --bootstrap-server 127.0.0.1:9092

./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --describe --topic kafka_demo_test_topic

topic:kafka_demo_test_topic partitioncount:6 replicationfactor:1 configs:

topic: kafka_demo_test_topic partition: 0 leader: 0 replicas: 0 isr: 0

topic: kafka_demo_test_topic partition: 1 leader: 0 replicas: 0 isr: 0

topic: kafka_demo_test_topic partition: 2 leader: 0 replicas: 0 isr: 0

topic: kafka_demo_test_topic partition: 3 leader: 0 replicas: 0 isr: 0

topic: kafka_demo_test_topic partition: 4 leader: 0 replicas: 0 isr: 0

topic: kafka_demo_test_topic partition: 5 leader: 0 replicas: 0 isr: 0

./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 localhost:2181 --list

note: this will not show information about old zookeeper-based consumers.

kafka_demo_test_topic

kafkademo_test_group

./bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group kafkademo_test_group

note: this will not show information about old zookeeper-based consumers.

topic partition current-offset log-end-offset lag consumer-id host client-id

kafka_demo_test_topic 1 114 114 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

kafka_demo_test_topic 2 98 98 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

kafka_demo_test_topic 5 95 95 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

kafka_demo_test_topic 0 99 99 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

kafka_demo_test_topic 4 84 84 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

kafka_demo_test_topic 3 100 100 0 consumer-1-e989cb0d-d9b5-4473-8317-feb897e2e686 /127.0.0.1 consumer-1

current_offset 當前消費offset

log_eng_offset 最新的offset

lag 落後多少

增加分割槽數 只能加不能減

./bin/kafka-topics.sh --zookeeper 127.0.0.1:2181 --alter --partitions 8 --topic kafka_demo_test_topic

linux運維常用命令

1.刪除0位元組檔案 find type f size 0 exec rm rf 2.檢視程序 按記憶體從大到小排列 ps e o c p z a sort k5 nr 3.按cpu利用率從大到小排列 ps e o c p z a sort nr 4.列印說 cache 裡的url 5.檢視http...

linux運維常用命令

chkconfig list awk 41.kudzu檢視網絡卡型號 kudzu probe class network 匹配中文字元的正規表示式 u4e00 u9fa5 評注 匹配中文還真是個頭疼的事,有了這個表示式就好辦了 匹配雙位元組字元 包括漢字在內 x00 xff 評注 可以用來計算字串的...

linux運維常用命令

1 linux啟動過程 開啟電源 bios開機自檢 引導程式lilo或grub 核心的引導 kernel boot 執行init rc.sysinit rc mingetty 建立終端 shell 2 網絡卡繫結多ip ifconfig eth0 1 192.168.1.99 netmask 255...