1. 程式人生 > >kafka 檢視佇列資訊

kafka 檢視佇列資訊

版本2.11

配置好之後:

在bin目錄下執行:./kafka-consumer-groups.sh  -bootstrap-server abc.db.cloud.com:9016 -list

報錯:

Error: Executing consumer group command failed due to Request METADATA failed on brokers List

然後我又執行:./kafka-consumer-groups.sh  -bootstrap-server abc.db.cloud.com:9016 -describe -group vcs

報錯:

[2018-07-25 19:55:57,914] WARN Bootstrap broker abc.db.cloud.com:9016 (id: -1 rack: null) disconnected (org.apache.kafka.clients.NetworkClient)
Error: Executing consumer group command failed due to The consumer group command timed out while waiting for group to initialize:

然後又執行:./kafka-consumer-groups.sh  -bootstrap-server abc.db.cloud.com:9016 -describe -group vcs --command-config /usr/share/kafka/config/consumer.properties (只是多了一個指向consumer.properties的配置項)

報錯:

Exception in thread "main" java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration. System property 'java.security.auth.login.config' is not set

修改./bin/kafka-consumer-group.sh:

[[email protected] bin]# cat ./kafka-consumer-groups.sh 
#!/bin/bash
# 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.
export KAFKA_OPTS=" -Djava.security.auth.login.config=/usr/share/kafka/config/kafka_client_jaas.conf"
exec $(dirname $0)/kafka-run-class.sh kafka.admin.ConsumerGroupCommand "
[email protected]
"

再執行:./kafka-consumer-groups.sh  -bootstrap-server abc.db.cloud.com:9016 -describe -group vcs --command-config /usr/share/kafka/config/consumer.properties

不再報錯,可以顯示:

TOPIC                          PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG        CONSUMER-ID                                       HOST                           CLIENT-ID
tv.tpvcs.setvcs                2          13              13              0          -                                                 -                              -
tv.tpvcs.setvcs                20         7               7               0          -                                                 -                              -