Kafka Offset相关命令总结

                Kafka Offset相关命令总结

                                      作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

 

 

一.查询topic的offset的范围

1>.查询某个topic的offset的最小值

[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -2         
yinzhengjie:23:0            #很显然,第一列为topic名称,第二列为partition名称,第三列则是offset。为估计仔细的你应该已经发现了最小的offset为0,分区数为30个
yinzhengjie:17:0
yinzhengjie:8:0
yinzhengjie:26:0
yinzhengjie:11:0
yinzhengjie:29:0
yinzhengjie:2:0
yinzhengjie:20:0
yinzhengjie:5:0
yinzhengjie:14:0
yinzhengjie:4:0
yinzhengjie:13:0
yinzhengjie:22:0
yinzhengjie:7:0
yinzhengjie:16:0
yinzhengjie:25:0
yinzhengjie:10:0
yinzhengjie:1:0
yinzhengjie:28:0
yinzhengjie:19:0
yinzhengjie:27:0
yinzhengjie:9:0
yinzhengjie:18:0
yinzhengjie:21:0
yinzhengjie:3:0
yinzhengjie:12:0
yinzhengjie:15:0
yinzhengjie:24:0
yinzhengjie:6:0
yinzhengjie:0:0
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -2 | wc -l
30
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -2
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -2
data.batch.ad:23:0
data.batch.ad:8:0
data.batch.ad:17:0
data.batch.ad:26:0
data.batch.ad:11:0
data.batch.ad:29:0
data.batch.ad:2:0
data.batch.ad:20:0
data.batch.ad:5:0
data.batch.ad:14:0
data.batch.ad:4:0
data.batch.ad:13:0
data.batch.ad:22:0
data.batch.ad:7:0
data.batch.ad:16:0
data.batch.ad:25:0
data.batch.ad:10:0
data.batch.ad:1:0
data.batch.ad:28:0
data.batch.ad:19:0
data.batch.ad:18:0
data.batch.ad:27:0
data.batch.ad:9:0
data.batch.ad:3:0
data.batch.ad:12:0
data.batch.ad:21:0
data.batch.ad:15:0
data.batch.ad:6:0
data.batch.ad:24:0
data.batch.ad:0:0
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -1 |wc -l
30
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -2

2>.查询某个topic的offset的最大值

[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -1
yinzhengjie:23:0
yinzhengjie:17:0
yinzhengjie:8:0
yinzhengjie:26:0
yinzhengjie:11:0
yinzhengjie:29:0
yinzhengjie:2:0
yinzhengjie:20:0
yinzhengjie:5:0
yinzhengjie:14:0
yinzhengjie:4:0
yinzhengjie:13:0
yinzhengjie:22:0
yinzhengjie:7:0
yinzhengjie:16:0
yinzhengjie:25:0
yinzhengjie:10:1
yinzhengjie:1:1
yinzhengjie:28:1
yinzhengjie:19:0
yinzhengjie:27:0
yinzhengjie:9:0
yinzhengjie:18:0
yinzhengjie:21:0
yinzhengjie:3:0
yinzhengjie:12:0
yinzhengjie:15:0
yinzhengjie:24:0
yinzhengjie:6:0
yinzhengjie:0:0
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -1 | wc -l
30
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic yinzhengjie --time -1
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -1
data.batch.ad:23:49238022        #很明显,以冒号为分割,第一列为topic名称,第二列为partition 编号,第三列为当前最大的便宜量位置!
data.batch.ad:8:49149404
data.batch.ad:17:49170343
data.batch.ad:26:49316398
data.batch.ad:11:49346347
data.batch.ad:29:49607820
data.batch.ad:2:49061238
data.batch.ad:20:49450860
data.batch.ad:5:49247999
data.batch.ad:14:48938440
data.batch.ad:4:49174236
data.batch.ad:13:49218393
data.batch.ad:22:49384090
data.batch.ad:7:49170708
data.batch.ad:16:49288121
data.batch.ad:25:49228190
data.batch.ad:10:49318898
data.batch.ad:1:49343856
data.batch.ad:28:49569577
data.batch.ad:19:48935100
data.batch.ad:18:49223866
data.batch.ad:27:49192217
data.batch.ad:9:49038297
data.batch.ad:3:49042016
data.batch.ad:12:49329623
data.batch.ad:21:49200748
data.batch.ad:15:49426787
data.batch.ad:6:48866851
data.batch.ad:24:49559483
data.batch.ad:0:49538864
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -1 | wc -l
30
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.2.114:9092 -topic data.batch.ad --time -1

 

二.查看consumer group列表,使用--list参数

   查看consumer group列表有新、旧两种命令,分别查看新版(信息保存在broker中)consumer列表和老版(信息保存在zookeeper中)consumer列表,因而需要区分指定bootstrap--server和zookeeper参数:(本片博客测试的kafka版本为0.10.2.1)

[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --zookeeper 10.1.2.114:2181 --list
Note: This will only show information about consumers that use ZooKeeper (not those using the Java consumer API).        #很显然,为这里使用的是kafka 0.10.2.1版本,我们是查询不到对应的信息的!

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --zookeeper 10.1.2.114:2181 --list                #老版本的consumer信息都保存在zookeeper中,很显然,0.10.2.1这个版本已经将consumer信息自己保存啦!
[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --bootstrap-server 10.1.2.114:9092 --list            #查看新版consumer列表,很显然,我们可以查询到对应的数据
Note: This will only show information about consumers that use the Java consumer API (non-ZooKeeper-based consumers).

id-data.batch.ad
console-consumer-19829
id-data.batch.env
id-data.batch.er
id-data.batch.pl
console-consumer-89705
id-data.batch.op
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --bootstrap-server 10.1.2.114:9092 --list            #查看新版consumer列表,很显然,我们可以查询到对应的数据

 

三.查看指定group.id 的消费者消费情况 (kafka-consumer-groups.sh)

[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --new-consumer --bootstrap-server 10.1.2.114:9092  --group id-data.batch.ad --describe
Note: This will only show information about consumers that use the Java consumer API (non-ZooKeeper-based consumers).


TOPIC                          PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG        CONSUMER-ID                                       HOST                           CLIENT-ID
data.batch.ad                  0          11429760        60611215        49181455   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  1          11363578        60437068        49073490   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  2          11347020        60122120        48775100   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  3          11398129        60102481        48704352   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  4          11375120        60212371        48837251   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  5          11384963        60221389        48836426   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  6          11375026        59769939        48394913   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  7          11394440        60151103        48756663   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  8          11405858        60116870        48711012   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  9          11398852        60044816        48645964   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  10         11371199        60338514        48967315   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  11         11407641        60304929        48897288   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  12         11417354        60378434        48961080   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  13         11385386        60333514        48948128   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  14         11353160        59954159        48600999   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  15         11445668        60630869        49185201   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  16         11376487        60375452        48998965   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  17         11405465        60245196        48839731   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  18         11406156        60222639        48816483   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  19         11380690        59987718        48607028   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  20         11436188        60585382        49149194   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  21         11421126        60222500        48801374   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  22         11428767        60506682        49077915   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  23         11385713        60308614        48922901   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  24         11416578        60688052        49271474   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  25         11412942        60235699        48822757   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  26         11403022        60389301        48986279   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  27         11402134        60223934        48821800   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  28         11422651        60658948        49236297   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
data.batch.ad                  29         11432147        60800417        49368270   consumer-1-53498a12-e62b-46c8-9c5c-ad97f807698d   /10.1.2.112                    consumer-1
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --new-consumer --bootstrap-server 10.1.2.114:9092  --group id-data.batch.ad --describe | grep ad | wc -l
Note: This will only show information about consumers that use the Java consumer API (non-ZooKeeper-based consumers).

30
[root@node101.yinzhengjie.org.cn ~]# 

简单对每列进行说明:

TOPIC:
  消费者的topic名称  
PARTITION:
  分区数的名称  

CURRENT-OFFSET:
  consumer group最后一次提交的offset

LOG-END-OFFSET:
  最后提交的生产消息offset
LAG
  消费offset与生产offset之间的差值
CONSUMER-ID
  消费者的ID编号,我们知道消费者组里面可以有最少要有一个消费者,当然也可以有多个消费者。
HOST
  消费者的主机IP地址。
CLIENT-ID
  链接的ID编号。
[root@node101.yinzhengjie.org.cn ~]# kafka-consumer-groups.sh --new-consumer --bootstrap-server 10.1.2.114:9092 --group id-data.batch.ad --describe

 

四. 查询 __consumer_offsets topic 所有内容

1>.运行下面命令前先要在consumer.properties中设置exclude.internal.topics=false

[root@node101.yinzhengjie.org.cn ~]# cat /soft/kafka/config/consumer.properties 
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# see kafka.consumer.ConsumerConfig for more details

# Zookeeper connection string
# comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"
zookeeper.connect=127.0.0.1:2181

# timeout in ms for connecting to zookeeper
zookeeper.connection.timeout.ms=6000

#consumer group id
group.id=test-consumer-group

#consumer timeout
#consumer.timeout.ms=5000

exclude.internal.topics=false
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat /soft/kafka/config/consumer.properties

2>.0.11.0.0之前版本

[root@node101.yinzhengjie.org.cn ~]# kafka-console-consumer.sh --topic __consumer_offsets --bootstrap-server 10.1.2.114:9092 --formatter "kafka.coordinator.GroupMetadataManager\$OffsetsMessageFormatter" --consumer.config /soft/kafka/config/consumer.properties --from-beginning
.......
[0416-data.batch.ad,data.batch.ad,107]::[OffsetMetadata[9640759,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,103]::[OffsetMetadata[9479545,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,96]::[OffsetMetadata[9561634,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,116]::[OffsetMetadata[9643818,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,106]::[OffsetMetadata[9604096,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,102]::[OffsetMetadata[9509155,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,111]::[OffsetMetadata[9515197,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,99]::[OffsetMetadata[9475217,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,110]::[OffsetMetadata[9603634,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,108]::[OffsetMetadata[9836363,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,105]::[OffsetMetadata[9552080,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,101]::[OffsetMetadata[9623973,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,119]::[OffsetMetadata[9683087,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,98]::[OffsetMetadata[9326071,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,114]::[OffsetMetadata[9428070,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,115]::[OffsetMetadata[9578810,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,118]::[OffsetMetadata[9599649,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,100]::[OffsetMetadata[9612879,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,109]::[OffsetMetadata[9545059,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,97]::[OffsetMetadata[9508272,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,112]::[OffsetMetadata[9518640,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,113]::[OffsetMetadata[9700809,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,104]::[OffsetMetadata[9429872,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,117]::[OffsetMetadata[9588574,96ef03f3-528a-4354-9b56-7b98ea258ba4],CommitTime 1555468633718,ExpirationTime 1555555033718]
[0416-data.batch.ad,data.batch.ad,1]::[OffsetMetadata[9632308,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,14]::[OffsetMetadata[9554051,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,11]::[OffsetMetadata[9650929,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,21]::[OffsetMetadata[9676355,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,5]::[OffsetMetadata[9453642,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,17]::[OffsetMetadata[9582307,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,4]::[OffsetMetadata[9517157,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,8]::[OffsetMetadata[9520614,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,20]::[OffsetMetadata[9571706,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,13]::[OffsetMetadata[9601455,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,23]::[OffsetMetadata[9559903,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,18]::[OffsetMetadata[9427121,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,2]::[OffsetMetadata[9427189,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,7]::[OffsetMetadata[9697701,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,12]::[OffsetMetadata[9648771,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,16]::[OffsetMetadata[9612199,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,0]::[OffsetMetadata[9597779,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,9]::[OffsetMetadata[9424049,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,3]::[OffsetMetadata[9475850,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
[0416-data.batch.ad,data.batch.ad,10]::[OffsetMetadata[9662179,b350dc94-868b-42a5-91f3-7fb59ca7ea93],CommitTime 1555468633735,ExpirationTime 1555555033735]
.......
[root@node101.yinzhengjie.org.cn ~]# kafka-console-consumer.sh --topic __consumer_offsets --bootstrap-server 10.1.2.114:9092 --formatter "kafka.coordinator.GroupMetadataManager\$OffsetsMessageFormatter" --consumer.config /soft/kafka/config/consumer.properties --from-beginning

3>. 0.11.0.0之后版本(含)

 [root@node101.yinzhengjie.org.cn ~]# kafka-console-consumer.sh --topic __consumer_offsets --bootstrap-server 10.1.2.114:9092 --formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter" --consumer.config /soft/kafka/config/consumer.properties --from-beginning

 

五.

 

 

六.

 

posted @ 2019-03-12 00:47  尹正杰  阅读(6152)  评论(0编辑  收藏  举报