1.准备jre1.8环境
2.scala环境
3.sbt环境
4.准备kafka-manager源码包: 下载地址(https://github.com/yahoo/kafka-manager/tags)
5.kafka和zookeeper环境(用于安装完后链接测试)
2.1 下载scala:
下载地址:https://www.scala-lang.org/download/
2.2 安装scala:
双击msi,按引导直接下一步下一步就行。
安装完会自动添加环境变量。
验证是否安装成功:
C:\Users\95> scala -version
Scala code runner version 2.12.2 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.
3.1 查看kafka-manager要求的sbt版本:
3.2 下载对应的sbt版本:
下载地址:https://www.scala-sbt.org/download.html
3.3 安装sbt:
双击msi,按引导直接下一步下一步就行。
安装完会自动添加环境变量。
安装完初始化:
1.打开cmd命令行,输入:sbt
然后会开始下载依赖包,时间相对较慢,耐心等待一段时间。
2.下载完之后,类似如下操作,输入sbtVersion检查版本:
downloading file:/C:/Users/95/.sbt/preloaded/com.github.ben-manes.caffeine/caffeine/2.5.6/jars/caffeine.jar ...
[SUCCESSFUL ] com.github.ben-manes.caffeine#caffeine;2.5.6!caffeine.jar (16ms)
downloading file:/C:/Users/95/.sbt/preloaded/org.scala-sbt.ivy/ivy/2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832/jars/ivy.jar ...
[SUCCESSFUL ] org.scala-sbt.ivy#ivy;2.3.0-sbt-cb9cc189e9f3af519f9f102e6c5d446488ff6832!ivy.jar (18ms)
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
80 artifacts copied, 0 already retrieved (28561kB/445ms)
Getting Scala 2.12.7 (for sbt)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
5 artifacts copied, 0 already retrieved (19715kB/54ms)
[info] Updated file C:\Users\95\project\build.properties: set sbt.version to 1.2.8
[info] Loading project definition from C:\Users\95\project
[info] Updating ProjectRef(uri("file:/C:/Users/95/project/"), "root-95-build")...
[info] Done updating.
[info] Set current project to root-95 (in build file:/C:/Users/95/)
[info] sbt server started at local:sbt-server-b8eb3c7e8281debcdc6f
sbt:root-95> sbtVersion
[info] 1.2.8
打开cmd命令行,进入kafka-manager解压后的根目录:
C:\Users\95\Desktop\kafka-manager-master> sbt clean dist
然后等待下载依赖包,这是一个漫长的过程,耐心等待。执行完会看到类似如下输出:
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Wrote C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\kafka-manager_2.12-2.0.0.2.pom
[info] Main Scala API documentation to C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\api...
[info] Compiling 131 Scala sources and 2 Java sources to C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\classes ...
[info] LESS compiling on 1 source(s)
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.8. Compiling...
[info] Packaging C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\kafka-manager_2.12-2.0.0.2-web-assets.jar ...
[info] Done packaging.
[info] Compilation completed in 12.274s.
model contains 604 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\kafka-manager_2.12-2.0.0.2-javadoc.jar ...
[info] Done packaging.
[info] Done compiling.
[info] Packaging C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\kafka-manager_2.12-2.0.0.2.jar ...
[info] Done packaging.
[info] Packaging C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\scala-2.12\kafka-manager_2.12-2.0.0.2-sans-externalized.jar ...
[info] Done packaging.
[success] All package validations passed
[info] Your package is ready in C:\Users\95\Desktop\kafka-manager-master\kafka-manager-master\target\universal\kafka-manager-2.0.0.2.zip
[success] Total time: 361 s, completed 2019-9-23 9:20:08
然后进入kafka-manager解压根目录下的:target/universal,看到目录中有个zip文件包。
5.1 解压刚才打包出的文件:
最好是修改下目录名,放在D:盘根目录下:
不然等会儿启动时可能会报这个错误:
D:\kafka-manager-2.0.0.2\bin>kafka-manager
输入行太长。
命令语法不正确。
5.2 修改配置:
5.3 启动服务:
D:\kafka-manager\bin>kafka-manager.bat
2019-09-23 10:05:34,983 - [WARN] application - application.conf @ file:/D:/kafka-manager/conf/application.conf: 12: play.crypto.secret is deprecated, use play.http.secret.key instea
2019-09-23 10:05:35,258 - [WARN] o.a.c.r.ExponentialBackoffRetry - maxRetries too large (100). Pinning to 29
2019-09-23 10:05:35,324 - [INFO] o.a.z.ZooKeeper - Client environment:zookeeper.version=3.4.13-2d71af4dbe22557fda74f9a9b4309b15a7487f03, built on 06/29/2018 00:39 GMT
2019-09-23 10:05:35,325 - [INFO] o.a.z.ZooKeeper - Client environment:host.name=95-PC
2019-09-23 10:05:35,325 - [INFO] o.a.z.ZooKeeper - Client environment:java.version=1.8.0_131
2019-09-23 10:05:35,325 - [INFO] o.a.z.ZooKeeper - Client environment:java.vendor=Oracle Corporation
2019-09-23 10:05:35,325 - [INFO] o.a.z.ZooKeeper - Client environment:java.home=D:\Program Files\Java\jdk1.8.0_131\jre
2019-09-23 10:05:35,325 - [INFO] o.a.z.ZooKeeper - Client environment:java.class.path=D:\kafka-manager\bin\\\..\lib\\..\conf\;D:\kafka-manager\bin\\\..\lib\\kafka-manager.kafka-mana
如果要指定web端口,使用如下命令:
D:\kafka-manager\bin>kafka-manager.bat -Dhttp.port=8080
5.4 浏览器测试:
打开浏览器,输入:http://127.0.0.1:9000
添加集群:
查看集群概要:
查看brokers:
查看topics: