众所周知(反正不管你知不知道),kafka-maneger更名了,现在叫cmak!原因是什么呢?据不可靠小道信息说,原kafka-manager这个名字涉及到kafka商标使用问题,应该是被律师函警告了,所以就换名了~
1.下载地址:
https://github.com/yahoo/CMAK
下载后,解压后如上图
注:本次下载最新版本包,之前的老版本下载后还需要自己编译代码然后再部署使用,新版不用,根本不用!
2.解压缩后,将解压包放到合适的位置,然后修开配置文件application.conf
修改如下, 红框中的改成自己的集群地址就OK了,如果是本机部署,直接写本机ip
注:kafka-manager.zkhosts后续会废弃掉,可以注释掉,只保留cmak.zkhosts配置
3.启动cmak
进入目录cmak-3.0.0.6/bin下sh cmak
启动成功
4.进入平台
地址:http://172.30.19.168:9000/
5. 添加add clusters
参数添加:
然后保存就行了
保存完就可以看到下图,红框的内容,第一次部署是没有红框内容的,只有添加完clusters才会出现
6.愉快的使用
7.启动日志报错:Failed to get broker metrics for BrokerIdentity(0,localhost,-1,false,true,Map(PLAINTEXT -> 9092))
如果报错会影响Mwtrics模块没数据
报错信息:
2024-07-02 19:38:12,373 - [ERROR] - from kafka.manager.actor.cluster.BrokerViewCacheActor in kafka-manager-system-akka.actor.default-dispatcher-8
Failed to get broker metrics for BrokerIdentity(0,localhost,-1,false,true,Map(PLAINTEXT -> 9092))
java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled!
at scala.Predef$.require(Predef.scala:281)
at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:39)
at kafka.manager.actor.cluster.BrokerViewCacheActor.$anonfun$updateBrokerMetrics$3(BrokerViewCacheActor.scala:359)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2024-07-02 19:38:12,373 - [ERROR] - from kafka.manager.actor.cluster.BrokerViewCacheActor in kafka-manager-system-akka.actor.default-dispatcher-8
Failed to get broker topic segment metrics for BrokerIdentity(0,localhost,-1,false,true,Map(PLAINTEXT -> 9092))
java.lang.IllegalArgumentException: requirement failed: No jmx port but jmx polling enabled!
at scala.Predef$.require(Predef.scala:281)
at kafka.manager.jmx.KafkaJMX$.doWithConnection(KafkaJMX.scala:39)
at kafka.manager.actor.cluster.BrokerViewCacheActor.$anonfun$updateBrokerTopicPartitionsSize$3(BrokerViewCacheActor.scala:383)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
8.解决方案
在kafka-server-start.sh中开头添加一行代码,然后重启kafka,报错解决了
export JMX_PORT="9999"
kafka-server-start.sh 路径:../kafka/3.7.0/libexec/bin
如果忘记kafka安装路径,可以通过以下方式:
1.通过whereis kafka-server-start 命令找到命令目录
2.cd 路径,如:cd /opt/homebrew/bin/
3.在/opt/homebrew/bin/目录找到kafka-server-start
4.cd ../Cellar/kafka/3.7.0/bin/ 然后找到kafka-server-start
5.cat kafka-server-start 查看命令的执行位置,我们会发现实际执行是:
/opt/homebrew/Cellar/kafka/3.7.0/libexec/bin/kafka-server-start.sh
6.vim /opt/homebrew/Cellar/kafka/3.7.0/libexec/bin/kafka-server-start.sh 然后添加export JMX_PORT="9999"