CMAK(Kafka Manager) 新手指南
Yahoo 开源的 Kafka 管理利器,10K star,之前叫 Kafka Manager。
依赖项
- JDK 11+(否则无法启动)
- Zookeeper 3.5+(否则无法使用)
1. 准备安装
1.1 Download package
上 cmak githubopen in new window 的 release 页面open in new window下载最新版本。
本例中为最新版本 cmak-3.0.0.5open in new window
1.2 Download JDK
解压后添加环境变量(export JAVA_HOME='/data/bigdata/jdk-11.0.2'
),或之后在 CMAK命令后面添加参数 -java-home /data/bigdata/jdk-11.0.2
1.3 修改配置文件
配置为用于存储 cmak 信息的 zookeeper 地址。
# vim conf/application.conf
# Settings prefixed with 'kafka-manager.' will be deprecated, use 'cmak.' instead.
# https://github.com/yahoo/CMAK/issues/713
kafka-manager.zkhosts="kafka-manager-zookeeper:2181" ## 修改
cmak.zkhosts="kafka-manager-zookeeper:2181" ## 修改
1
2
3
4
5
2
3
4
5
2. 启动 CMAK
bin/cmak -Dhttp.port=8080
1
3. 使用 CMAK(添加 Cluster)
3.1 添加 Cluster
- Enable JMX Polling, 可以查看监控数据,前提是 Broker 开启了 JMX
- Poll consumer information,可以查询消费者信息
添加完后,可以看到 Cluster 列表。
3.2 查看使用情况
- Cluster Summary
- Broker
Topic List
Topic Detail
- Consumer
FAQ
this version of the Java Runtime only recognizes class file versions up to 52.0
启动 CMAK 有如下报错
[INFO] p.c.s.AkkaHttpServer - Stopping server...
[ERROR] a.a.ActorSystemImpl - Uncaught error from thread [application-akka.actor.default-dispatcher-7]: controllers/routes has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0, shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[application]
java.lang.UnsupportedClassVersionError: controllers/routes has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[INFO] k.m.a.KafkaManagerActor - Shutting down kafka manager
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
原因,JDK 版本过低,github 中说明要求 Java 11+,换成 JDK 11 即可解决。
Yikes! KeeperErrorCode = Unimplemented for /kafka-manager/mutex Try again.
之前启动 CMAK 的 ZooKeeper 是 CDH6.3.1 中带的 3.4.5-cdh6.3.1,换成 3.5+ 的 ZooKeeper 即可解决。