07【線上日誌分析】之kafka-manager監控工具的搭建(sbt安裝與編譯)

hackeruncle發表於2017-01-07

1.下載sbt

[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

 

---------------------------------------------------------------------------------------------

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
[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 &



07【線上日誌分析】之kafka-manager監控工具的搭建(sbt安裝與編譯)

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按鈕
07【線上日誌分析】之kafka-manager監控工具的搭建(sbt安裝與編譯)

 b.Brokers

07【線上日誌分析】之kafka-manager監控工具的搭建(sbt安裝與編譯)

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30089851/viewspace-2132052/,如需轉載,請註明出處,否則將追究法律責任。

相關文章