kafka-manager 之神坑
Kafka-manager 安装之 神坑
1 2022-02-14 18:14:27,580 - [ERROR] - from kafka.manager.actor.cluster.BrokerViewCacheActor in kafka-manager-system-akka.actor.default-dispatcher-6 2 Failed to get broker metrics for BrokerIdentity(0,kafka1.sd.cn,-1,false,true,Map(PLAINTEXT -> 9092)) 3 java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled! 4 at scala.Predef$.require(Predef.scala:281) 5 at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:39) 6 at kafka.manager.actor.cluster.BrokerViewCacheActor.$anonfun$updateBrokerMetrics$3(BrokerViewCacheActor.scala:359) 7 at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) 8 at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659) 9 at scala.util.Success.$anonfun$map$1(Try.scala:255) 10 at scala.util.Success.map(Try.scala:213) 11 at scala.concurrent.Future.$anonfun$map$1(Future.scala:292) 12 at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33) 13 at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33) 14 at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) 15 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 16 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 17 at java.base/java.lang.Thread.run(Thread.java:834)
解决方法
1、修改 kafka-server-start.sh,增加 JMX 的端口信息
kafka_2.12-3.1.0/bin/kafka-server-start.sh
1 if [ $# -lt 1 ]; 2 then 3 echo "USAGE: $0 [-daemon] server.properties [--override property=value]*" 4 exit 1 5 fi 6 base_dir=$(dirname $0) 7 8 if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then 9 export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" 10 fi 11 12 if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then 13 export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" 14 export JMX_PORT="9988" 15 fi
2、修改kafka-run-class.sh,增加绿色部分,注意对应的 ip地址。
for file in "$base_dir"/core/build/libs/kafka_${SCALA_BINARY_VERSION}*.jar; do if should_include_file "$file"; then CLASSPATH="$CLASSPATH":"$file" fi done shopt -u nullglob if [ -z "$CLASSPATH" ] ; then echo "Classpath is empty. Please build the project first e.g. by running './gradlew jar -PscalaVersion=$SCALA_VERSION'" exit 1 fi # JMX settings if [ -z "$KAFKA_JMX_OPTS" ]; then KAFKA_JMX_OPTS="-Djava.rmi.server.hostname=kafka1.sd.cn -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote. ssl=false " fi # JMX port to use if [ $JMX_PORT ]; then KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT " fi # Log directory to use if [ "x$LOG_DIR" = "x" ]; then LOG_DIR="$base_dir/logs" fi
修改完毕记得重启 kafka 服务
本文来自博客园,作者:IT老登,转载请注明原文链接:https://www.cnblogs.com/nb-blog/p/15893782.html