安装
下载
编译
[root@hadoop102 kafka-manager]# pwd
/root/kafka-manager
[root@hadoop102 kafka-manager]# ./sbt clean dist
# ...
# 要等好一会
# ...
[info] Done packaging.
[info]
[info] Your package is ready in /root/kafka-manager/target/universal/kafka-manager-1.3.3.22.zip
[info]
[success] Total time: 1569 s, completed Mar 6, 2019 5:15:28 PM
编译好的就是/root/kafka-manager/target/universal/kafka-manager-1.3.3.22.zip
压缩包
安装
[root@iZj6c5bdyyg7se9hbjaakuZ opt]# cp /root/kafka-manager/target/universal/kafka-manager-1.3.3.22.zip .
[root@iZj6c5bdyyg7se9hbjaakuZ opt]# unzip kafka-manager-1.3.3.22.zip
[root@iZj6c5bdyyg7se9hbjaakuZ opt]# ls
kafka_2.12-2.1.0 kafka-manager-1.3.3.22 kafka-manager-1.3.3.22.zip zookeeper-3.4.12
[root@iZj6c5bdyyg7se9hbjaakuZ opt]# cd kafka-manager-1.3.3.22
[root@iZj6c5bdyyg7se9hbjaakuZ kafka-manager-1.3.3.22]# vim conf/application.conf
# 修改配置文件,我的zk和kafka在同一台机器上
[root@iZj6c5bdyyg7se9hbjaakuZ kafka-manager-1.3.3.22]# cat conf/application.conf | grep zkhost
kafka-manager.zkhosts="localhost:2181"
kafka-manager.zkhosts=${?ZK_HOSTS}
[root@iZj6c5bdyyg7se9hbjaakuZ kafka-manager-1.3.3.22]#
启动
- -Dconfig.file 指定配置文件
- -Dhttp.port 指定端口
./bin/kafka-manager -Dconfig.file=/opt/kafka-manager-1.3.3.22/conf/application.conf -Dhttp.port=80
成功运行
遇到的报错
sbt工具被墙的问题
请看我的上一篇文章:
关于sbt构建工具国内无法使用的问题
缺少nodejs
[info] Wrote /opt/kafka-manager/target/scala-2.11/kafka-manager_2.11-1.3.3.22.pom
Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js.
[info] Compiling 127 Scala sources and 2 Java sources to /opt/kafka-manager/target/scala-2.11/classes...
/usr/share/sbt/sbt: line 2: 4936 Killed java $SBT_OPTS -jar /usr/share/sbt/bin/sbt-launch.jar "$@"
[root@iZj6c5bdyyg7se9hbjaakuZ kafka-manager]#
安装nodejs
yum install -y nodejs
JDK无法分配内存(未解决)
[info] Wrote /opt/kafka-manager/target/scala-2.11/kafka-manager_2.11-1.3.3.22.pom
[info] Compiling 127 Scala sources and 2 Java sources to /opt/kafka-manager/target/scala-2.11/classes...
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 115224576, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 115224576 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /opt/kafka-manager/hs_err_pid5016.log
[root@iZj6c5bdyyg7se9hbjaakuZ kafka-manager]#
后来查看是我的内存的确占满了,,不了解java的内存限制导致的
直接修改sbt
启动文件,限制内存占用就可以了
[root@iZj6c5bdyyg7se9hbjaakuZ sbt]# cat sbt
SBT_OPTS="-Xms256M -Xmx256M -Xss256K -XX:CompressedClassSpaceSize=128m -XX:MetaspaceSize=200m -XX:MaxMetaspaceSize=200m"
java $SBT_OPTS -jar /usr/share/sbt/bin/sbt-launch.jar "$@"
[root@iZj6c5bdyyg7se9hbjaakuZ sbt]#
具体java的JVM参数调整还需各位自行解决,我也不太懂
后来我干脆换了个大内存机器解决了问题,,,,
网友评论