【APM】Pinpoint 安裝部署(一)


Pinpoint簡介

  Pinpoint是用Java / PHP編寫的大規模分布式系統的APM(應用程序性能管理)工具。受Dapper的啟發,Pinpoint提供了一種解決方案,可通過跟蹤跨分布式應用程序的事務來幫助分析系統的整體結構以及其中的組件如何互連。

  特點:

  • 一目了然地了解您的應用程序拓撲
  • 監控應用程序的實時
  • 獲得每筆交易的代碼級可見性
  • 安裝APM代理而無需更改任何代碼
  • 對性能的影響最小(資源使用量增加約3%)

  參考git地址:https://github.com/naver/pinpoint

  pinpoint架構圖

    

Pinpoint安裝部署

  前期准備

     本例在ContenOS 7.4 下安裝,本次需要安裝pinpoint和pinpoint-agent和hbase、zookeeper,先在git上將需要用到的安裝包都下載好

     hbase下載地址:https://hbase.apache.org/downloads.html,pinpoint下載地址:https://github.com/naver/pinpoint/releases

     安裝它用到的2台服務器,一台主要部署pinpoint和pinpoint-agent,一台主要部署hbase、zookeeper

    • jdk8 --- Java運行環境
    • hbase-1.2.7 --- 數據庫(單機版自帶zookeeper),用來存儲監控信息
    • tomcat9.0 --- Web服務器
    • pinpoint-collector-1.8.5.war --- pp的控制器
    • pinpoint-web-1.8.5.war --- pp展示頁面
    • pinpoint-agent-1.8.5.tar.gz --- pp探針

  安裝hbase

    在第一台服務器192.168.1.5上安裝

    1、在hbase官網上下載hbase,本例安裝的是hbase-1.2.7版,因為pinpoint和hbase有版本兼容的問題,可能導致pinpoint收集器無法寫入數據到hbase

     安裝參考:【HBase】HBase 單機版安裝及使用

     hbase的hbase-site.xml配置文件如下

 1 <configuration>                                                                                                  
 2   <!-- hbase存放數據目錄 -->                                                                                     
 3   <property>                                                                                                     
 4     <name>hbase.rootdir</name>                                                                                   
 5     <value>file:///data/soft/hbase-1.2.7/hbase</value>                                                           
 6   </property>                                                                                                    
 7                                                                                                                  
 8   <!-- ZooKeeper數據文件路徑 -->                                                                                 
 9   <property>                                                                                                     
10     <name>hbase.zookeeper.property.dataDir</name>                                                                
11     <value>/data/soft/hbase-1.2.7/zookeeper</value>                                                              
12   </property>                                                                                                    
13                                                                                                                  
14   <property>                                                                                                     
15         <name>hbase.zookeeper.property.clientPort</name>
16         <value>12181</value>
17   </property>
18 
19 
20   <property>
21     <name>hbase.unsafe.stream.capability.enforce</name>
22     <value>false</value>
23     <description>
24       Controls whether HBase will check for stream capabilities (hflush/hsync).
25 
26       Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
27       with the 'file://' scheme, but be mindful of the NOTE below.
28 
29       WARNING: Setting this to false blinds you to potential data loss and
30       inconsistent system state in the event of process and/or node failures. If
31       HBase is complaining of an inability to use hsync or hflush it's most
32       likely not a false positive.
33     </description>
34   </property>
35 
36 </configuration>
View Code

        安裝后並啟動hbase

     

    2、初始化Hbase的Pinpoint庫,在git中下載hase-create.hbase腳本文件,並安裝基礎表

       下載hase-create.hbase地址:https://github.com/naver/pinpoint/blob/master/hbase/scripts/hbase-create.hbase

      執行腳本命令:$HBASE_HOME/bin/hbase shell hbase-create.hbase

    3、執行完成后可以在Hbase的網頁中查看表信息

      

  安裝pinpoint-collector

    在第二台服務器192.168.1.6上安裝

    1、將下載好的pinpoint-collector-1.8.5.war解壓,並移動到tomcat的webapp中。

       解壓命令:unzip pinpoint-collector-1.8.5.war -d pinpoint-collector-1.8.5

       移動命令:mv pinpoint-collector-1.8.5 /data/soft/apache-tomcat-8081/webapps/

    2、進入/data/soft/apache-tomcat-8081/webapps/pinpoint-collector-1.8.5/WEB-INF/classes目錄,編輯配置文件

      

      注:收集器的端口配置文件pinpoint-collector.properties,里面可以設置接受探針發送過來的數據端口,需要與Agent搭配使用。默認9994、9995、9996。

      修改hbase.properties文件,配置zookeeper地址

      命令:vim hbase.properties

1 hbase.client.host=192.168.1.5
2 hbase.client.port=12181

      修改pinpoint-collector.properties,配置zookeeper地址

      命令:vim pinpoint-collector.properties

1 cluster.enable=true                                                                                              
2 cluster.zookeeper.address=192.168.1.5:12181                                                                      
3 cluster.zookeeper.sessiontimeout=30000                                                                           
4 cluster.listen.ip=                                                                                               
5 cluster.listen.port= 

    3、在192.168.1.6服務器上配置192.168.1.5服務器的hostname地址

       注:由於pinpoint-collector回到zookeeper中獲取hbase的地址,但是hbase在zookeeper中注冊的是自己的主機名稱,pinpoint-collector拿到的就hbase主機名稱,訪問的時候需要在hosts文件中配置主機名稱對應的IP地址

      命令:vim /etc/hosts

# hbasehostname為192.168.1.5的主機名稱
192.168.1.5    hbasehostname

    4、啟動tomcat,即將pinpoint的收集器部署好了

  安裝pinpoint-agent

    在第二台服務器192.168.1.6上安裝

    1、將下載好的pinpoint-agent-1.8.5.tar.gz進行解壓

      新建目錄:mkdir /data/soft/pinpoint/pinpoint-agent-1.8.5

      解壓命令:tar -zxvf pinpoint-agent-1.8.5.tar.gz -C /data/soft/pinpoint/pinpoint-agent-1.8.5

    2、對agent進行配置,編輯/data/soft/pinpoint/pinpoint-agent-1.8.5中的pinpoint.config文件,對pinpoint收集器信息進行配置

 

 1 profiler.collector.ip=127.0.0.1                                                                                  
 2                                                                                                                  
 3 # placeHolder support "${key}"                                                                                   
 4 profiler.collector.span.ip=${profiler.collector.ip}                                                              
 5 profiler.collector.span.port=9996                                                                                
 6                                                                                                                  
 7 # placeHolder support "${key}"                                                                                   
 8 profiler.collector.stat.ip=${profiler.collector.ip}                                                              
 9 profiler.collector.stat.port=9995                                                                                
10                                                                                                                  
11 # placeHolder support "${key}"                                                                                   
12 profiler.collector.tcp.ip=${profiler.collector.ip}                                                               
13 profiler.collector.tcp.port=9994

 

    3、在應用tomcat的bin/catalina.sh中,加入三句話,就安裝好pinpoint的探針了,如下:

1 #2019-11-11                                                                                                      
2 # 在20行增加如下字段                                                                                             
3 # 第一行是pp-agent的jar包位置                                                                                    
4 # 第二行是agent的ID,這個ID是唯一的,我是用pp + 今天的日期命名的,只要與其他的項目的ID不重復就好了               
5 # 第三行是采集項目的名字,這個名字可以隨便取,只要各個項目不重復就好了                                           
6 CATALINA_OPTS="$CATALINA_OPTS -javaagent:/data/soft/pinpoint/pinpoint-agent-1.8.5/pinpoint-bootstrap-1.8.5.jar"  
7 CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.agentId=pp20191112"                                                     
8 CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.applicationName=Tomcat8080"

    4、重啟應用tomcat,即可收集應用數據

  安裝pinpoint-web

    在第二台服務器192.168.1.6上安裝

    1、將下載好的pinpoint-web-1.8.5.war解壓,並移動到tomcat的webapp中。

       解壓命令:unzip pinpoint-web-1.8.5.war -d pinpoint

       移動命令:mv pinpoint /data/soft/apache-tomcat-8081/webapps/

    2、進入/data/soft/apache-tomcat-8081/webapps/pinpoint/WEB-INF/classes目錄,編輯配置文件

      

      修改hbase.properties文件,配置zookeeper地址

      命令:vim hbase.properties

1 hbase.client.host=192.168.1.5                                                                                   
2 hbase.client.port=12181  

      修改pinpoint-web.properties文件,配置zookeeper地址

      命令:vim pinpoint-web.properties

1 cluster.enable=true
2 cluster.web.tcp.port=9997
3 cluster.zookeeper.address=192.168.1.5:12181
4 cluster.zookeeper.sessiontimeout=30000
5 cluster.zookeeper.retry.interval=60000
6 cluster.connect.address=

    3、重啟應用tomcat8081,即可收集應用數據,使用地址http://192.168.1.6:8081/pinpiont,即可訪問pinpiont的web界面

      

    4、在界面中選擇一個應用即可看到應用使用的情況

      

 

 

 

      

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM