Programming/Kafka

[Kafka] No jmx port but jmx polling enabled

bisi 2020. 4. 21. 15:32

에러 내용 

kafka-manager 설치 후 topic 생성 중에

아래와 broker-0에는 에러가 안나는데 broker-1,2 에는 아래와 같은 에러가 발생하였다. 

 

> broker 1 Error

[error] k.m.a.c.BrokerViewCacheActor - Failed to get broker metrics for BrokerIdentity(1,DESKTOP-5V2566P.localdomain,-1,false,true,Map(PLAINTEXT -> 9093))
java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled!
        at scala.Predef$.require(Predef.scala:224) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:39) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateBrokerMetrics$1$$anonfun$apply$27$$anonfun$apply$3.apply$mcV$sp(BrokerViewCacheActor.scala:358) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateBrokerMetrics$1$$anonfun$apply$27$$anonfun$apply$3.apply(BrokerViewCacheActor.scala:355) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateBrokerMetrics$1$$anonfun$apply$27$$anonfun$apply$3.apply(BrokerViewCacheActor.scala:355) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_232]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_232]

 

> broker 2 Error

[error] k.m.a.c.BrokerViewCacheActor - Failed to get topic metrics for broker BrokerIdentity(2,DESKTOP-5V2566P.localdomain,-1,false,true,Map(PLAINTEXT -> 9094))
java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled!
        at scala.Predef$.require(Predef.scala:224) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:39) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateTopicMetrics$1$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply$2.apply$mcV$sp(BrokerViewCacheActor.scala:326) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateTopicMetrics$1$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply$2.apply(BrokerViewCacheActor.scala:323) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at kafka.manager.actor.cluster.BrokerViewCacheActor$$anonfun$kafka$manager$actor$cluster$BrokerViewCacheActor$$updateTopicMetrics$1$$anonfun$apply$24$$anonfun$apply$25$$anonfun$apply$2.apply(BrokerViewCacheActor.scala:323) ~[kafka-manager.kafka-manager-1.3.3.23-sans-externalized.jar:na]
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) ~[org.scala-lang.scala-library-2.11.12.jar:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_232]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_232]
        at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_232]

 

 

 

해결방법

원인은 JMX Port가 기본적으로 broker 하나만 잡혀 있었기 때문이다.

 

아래와 같이 kafka-server-start.sh 파일에 'export JMX_PORT=9999' 만 추가해주면 된다. 

 

#!/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.
# add JAM_PORT
export JMX_PORT=9999
if [ $# -lt 1 ];
then
        echo "USAGE: $0 [-daemon] server.properties [--override property=value]*"
        exit 1
fi
base_dir=$(dirname $0)

if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
    export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi

EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'}
....................

 

JMX_PORT 추가 해준뒤 다시 실행 시키면 에러 해결 완료!!