【kafka】Topic管理-創(chuàng)新互聯(lián)

1.查看已經(jīng)創(chuàng)建的Topic

我們提供的服務(wù)有:成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、民和ssl等。為上1000家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的民和網(wǎng)站制作公司
cd /usr/local/kafka
./bin/kafka-topics.sh --list --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181
186                    187                    188
------------------     ------------------     ------------------
__consumer_offsets     __consumer_offsets     __consumer_offsets
connect-test           connect-test           connect-test
test0320               test0320               test0320

2.創(chuàng)建topic

cd /usr/local/kafka
./bin/kafka-topics.sh --create --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 --partitions 3 --replication-factor 2  --topic test0326
# 創(chuàng)建后各broker上的物理目錄
186            187            188
----------     ----------     ----------
test0326-1     test0326-1     test0326-1
test0326-2     test0326-2     test0326-2

3.查看指定topic中Leader的信息

cd /usr/local/kafka
./bin/kafka-topics.sh --describe --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181  --topic test0326
Topic: test0326	PartitionCount:3	ReplicationFactor:2	Configs:
Topic: test0326	Partition: 0	Leader: 0	Replicas: 0,2	Isr: 0,2
Topic: test0326	Partition: 1	Leader: 1	Replicas: 1,0	Isr: 1,0
Topic: test0326	Partition: 2	Leader: 2	Replicas: 2,1	Isr: 2,1

4.查看consumer組內(nèi)消費(fèi)的offset

(1) 使用生產(chǎn)者生成一次

(2) 使用test組消費(fèi)一次

(3) test組當(dāng)前的消費(fèi)偏移

offset = 828 , partition=1, key = 4, value = hh老高4

offset = 829 , partition=1, key = 6, value = hh老高6

offset = 1095, partition=0, key = 1, value = hh老高1


offset = 1096, partition=0, key = 5, value = hh老高5

offset = 1097, partition=0, key = 7, value = hh老高7

offset = 1098, partition=0, key = 8, value = hh老高8

offset = 568 , partition=2, key = 0, value = hh老高0


offset = 569 , partition=2, key = 2, value = hh老高2

offset = 570 , partition=2, key = 3, value = hh老高3

offset = 571 , partition=2, key = 9, value = hh老高9

cd /usr/local/kafka
./bin/kafka-run-class.sh kafka.tools.ConsumerOffsetChecker --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 --group test --topic test0320
# [2018-03-26 11:06:17,939] WARN WARNING: ConsumerOffsetChecker is deprecated and will be dropped in releases following 0.9.0. Use ConsumerGroupCommand instead. (kafka.tools.ConsumerOffsetChecker$)
Group           Topic                          Pid Offset          logSize         Lag             Owner
test            test0320                       0   1099            1099            0               none
test            test0320                       1   830             830             0               none
test            test0320                       2   572             572             0               none

5.kafka-consumer-offset-checker.sh腳本

# bin/kafka-consumer-offset-checker.sh
Option                                  Description                            
------                                  -----------                            
--broker-info                           打印broker信息
--group                                 消費(fèi)著組
--help                                  幫助信息
--retry.backoff.ms <Integer>            ? Retry back-off to use for failed offset queries. (default: 3000)
--socket.timeout.ms <Integer>           ? Socket timeout to use when querying for offsets. (default: 6000)
--topic                                 以逗號(hào)分隔的消費(fèi)者主題列表(如果不存在的話,所有主題)
--zookeeper                             zookeeper地址

cd /usr/local/kafka
bin/kafka-consumer-offset-checker.sh --zookeeper 10.1.44.186:2181,10.1.44.187:2181,10.1.44.188:2181 --topic test0320 --group test --broker-info
[2018-03-26 11:24:52,014] WARN WARNING: ConsumerOffsetChecker is deprecated and will be dropped in releases following 0.9.0. Use ConsumerGroupCommand instead. (kafka.tools.ConsumerOffsetChecker$)
Group           Topic                          Pid Offset          logSize         Lag             Owner
test            test0320                       0   1115            1115            0               none
test            test0320                       1   838             838             0               none
test            test0320                       2   588             588             0               none
BROKER INFO
2 -> 10.1.44.188:9092
1 -> 10.1.44.187:9092
0 -> 10.1.44.186:9092

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。

分享名稱:【kafka】Topic管理-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://bm7419.com/article32/didepc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)建站公司、網(wǎng)站建設(shè)、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司、虛擬主機(jī)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)