版本2.11
前提是配置好sasl,可以参考:
http://www.cnblogs.com/iamsach/p/9234624.html
配置好之后:
在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:
[root@Server 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 "$@"
再执行:./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 – – –