这篇文章给大家介绍kafka-manager监控工具的搭建是怎样的,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
1.下载sbt
http://www.scala-sbt.org/download.html
[root@sht-sgmhadoopnn-01 app]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring sbt-0.13.13.tgz...
100% 1025 KB 1025 KB/sec 00:00:01 0 Errors
2.解压
[root@sht-sgmhadoopnn-01 app]# tar -zxvf sbt-0.13.13.tgz
sbt-launcher-packaging-0.13.13/
sbt-launcher-packaging-0.13.13/conf/
sbt-launcher-packaging-0.13.13/conf/sbtconfig.txt
sbt-launcher-packaging-0.13.13/conf/sbtopts
sbt-launcher-packaging-0.13.13/bin/
sbt-launcher-packaging-0.13.13/bin/sbt.bat
sbt-launcher-packaging-0.13.13/bin/sbt
sbt-launcher-packaging-0.13.13/bin/sbt-launch.jar
sbt-launcher-packaging-0.13.13/bin/sbt-launch-lib.bash
[root@sht-sgmhadoopnn-01 app]# mv sbt-launcher-packaging-0.13.13 sbt
3.添加脚本文件
[root@sht-sgmhadoopnn-01 bin]# vi sbt
#!/usr/bin/env bash
BT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar /root/learnproject/app/sbt/bin/sbt-launch.jar "$@"
4.修改权限和环境变量
[root@sht-sgmhadoopnn-01 bin]# chmod u+x sbt
[root@sht-sgmhadoopnn-01 bin]# vi /etc/profile
export SBT_HOME=/root/learnproject/app/sbt
export PATH=$SBT_HOME/bin:$SPARK_HOME/bin:$SCALA_HOME/bin:$HADOOP_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
"/etc/profile" 94L, 2265C written
[root@sht-sgmhadoopnn-01 bin]# source /etc/profile
5.测试
[root@sht-sgmhadoopnn-01 bin]# sbt sbt-version
[info] Set current project to bin (in build file:/root/learnproject/app/sbt/bin/)
[info] 0.13.13
[info] Set current project to bin (in build file:/root/learnproject/app/sbt/bin/)
[info] 0.13.13
[root@sht-sgmhadoopnn-01 bin]#
---------------------------------------------------------------------------------------------
因为kafka-manager编译需要jdk1.8
1.安装jdk1.8
[root@sht-sgmhadoopnn-01 app]# cd /usr/java
[root@sht-sgmhadoopnn-01 java]# ll
total 4
drwxr-xr-x 8 root root 4096 Nov 17 2015 jdk1.7.0_67-cloudera
[root@sht-sgmhadoopnn-01 java]# rz
rz waiting to receive.
Starting zmodem transfer. Press Ctrl+C to cancel.
Transferring jdk-8u102-linux-x64.tar.gz...
100% 177183 KB 425 KB/sec 00:06:56 0 Errors
[root@sht-sgmhadoopnn-01 java]# ll
total 177192
drwxr-xr-x 8 root root 4096 Nov 17 2015 jdk1.7.0_67-cloudera
-rw-r--r-- 1 root root 181435897 Jun 28 00:02 jdk-8u102-linux-x64.tar.gz
[root@sht-sgmhadoopnn-01 java]# tar -xzvf jdk-8u102-linux-x64.tar.gz
[root@sht-sgmhadoopnn-01 java]# vi /etc/profile
export PATH=/usr/java/jdk1.8.0_102/bin:$SBT_HOME/bin:$SPARK_HOME/bin:$SCALA_HOME/bin:$HADOOP_HOME/bin:$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH
[root@sht-sgmhadoopnn-01 java]# source /etc/profile
---------------------------------------------------------------------------------------------
https://github.com/yahoo/kafka-manager
Requirements:
Kafka 0.8.1.1 or 0.8.2.* or 0.9.0.*
Java 8+
1.下载,使用sbt编绎
[root@sht-sgmhadoopnn-01 ~]# cd /root/learnproject/compilesoft
[root@sht-sgmhadoopnn-01 compilesoft]# git clone https://github.com/yahoo/kafka-manager.git
[root@sht-sgmhadoopnn-01 compilesoft]# cd kafka-manager/
[root@sht-sgmhadoopnn-01 kafka-manager]# sbt clean dist
[info] Your package is ready in /root/learnproject/compilesoft/kafka-manager/target/universal/kafka-manager-1.3.2.1.zip
[info]
[success] Total time: 126 s, completed Dec 26, 2016 2:44:17 PM
2.解压
[root@sht-sgmhadoopnn-01 kafka-manager]# mv /root/learnproject/compilesoft/kafka-manager/target/universal/kafka-manager-1.3.2.1.zip /root/learnproject/app/
[root@sht-sgmhadoopnn-01 kafka-manager]# cd ../
[root@sht-sgmhadoopnn-01 app]# unzip kafka-manager-1.3.2.1.zip
[root@sht-sgmhadoopnn-01 app]# cd kafka-manager-1.3.2.1/conf
[root@sht-sgmhadoopnn-01 conf]# vi application.conf
kafka-manager.zkhosts="172.16.101.58:2181,172.16.101.59:2181,172.16.101.60:2181/kafka"
3.后台运行
[root@sht-sgmhadoopnn-01 kafka-manager-1.3.2.1]# nohup ./bin/kafka-manager -Dconfig.file=./conf/application.conf -Dhttp.port=9999 -java-home /usr/java/jdk1.8.0_102 >kafka-manager.log 2>&1 &
http://172.16.101.55:9999/
4.添加Cluster
a.Add Cluster
Cluster Name: onlinelog_analysis_kafkacluster
Cluster Zookeeper Hosts: 172.16.101.58:2181,172.16.101.59:2181,172.16.101.60:2181/kafka
勾选上 Enable JMX Polling (Set JMX_PORT env variable before starting kafka server)
再勾选下方的指标信息(参考截图)
单击Save按钮
b.Brokers
关于kafka-manager监控工具的搭建是怎样的就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。