1 系統環境
- Ubuntu 16.04 LTS
- hbase-1.2.6-bin.tar.gz(http://hbase.apache.org/)
- hbase-create.hbase(https://github.com/naver/pinpoint/tree/master/hbase/scripts)
- pinpoint-collector-1.7.2.war(https://github.com/naver/pinpoint/releases/tag/1.7.2)
- pinpoint-web-1.7.2.war(https://github.com/naver/pinpoint/releases/tag/1.7.2)
- pinpoint-agent-1.7.2.tar.gz(https://github.com/naver/pinpoint/releases/tag/1.7.2)
- apache-tomcat-8.5.24.tar.gz(部署使用)
2 部署過程
将需要的資源上傳伺服器,并確定已經安裝Java環境
2.1 安裝Hbase
1.解壓hbase tar包
tar -zxvf hbase-1.2.6-bin.tar.gz
2.修改hbase-env.sh的JAVA_HOME環境變量位址
export JAVA_HOME=/opt/apps/jdk/jdk1.8.0_131/
3.修改hbase-site.xml配置檔案
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///opt/apps/pinpoint/hbase-1.2.6/data</value>
</property>
</configuration>
4.啟動hbase
./start-hbase.sh
5.檢視Hbase是否啟動成功
jps
root@VM-0-15-ubuntu:/opt/apps/pinpoint/hbase-1.2.6/bin# jps
7652 HMaster
2277 Elasticsearch
14839 Main
7994 Jps
存在Hmaster程序說明啟動成功
6.初始化Hbase的pinpoint庫
./hbase shell /opt/apps/pinpoint/hbase-create.hbase
[email protected]:/opt/apps/pinpoint/hbase-1.2.6/bin# ./hbase shell /opt/apps/pinpoint/hbase-create.hbase
2018-04-27 11:29:35,228 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
0 row(s) in 1.8260 seconds
0 row(s) in 4.2500 seconds
0 row(s) in 4.2420 seconds
0 row(s) in 1.2260 seconds
0 row(s) in 1.2180 seconds
0 row(s) in 1.2170 seconds
0 row(s) in 1.2210 seconds
0 row(s) in 2.2250 seconds
0 row(s) in 1.2250 seconds
0 row(s) in 8.2820 seconds
0 row(s) in 1.2220 seconds
0 row(s) in 2.2210 seconds
0 row(s) in 1.2250 seconds
0 row(s) in 1.2150 seconds
0 row(s) in 1.2150 seconds
TABLE
AgentEvent
AgentInfo
AgentLifeCycle
AgentStatV2
ApiMetaData
ApplicationIndex
ApplicationMapStatisticsCallee_Ver2
ApplicationMapStatisticsCaller_Ver2
ApplicationMapStatisticsSelf_Ver2
ApplicationStatAggre
ApplicationTraceIndex
HostApplicationMap_Ver2
SqlMetaData_Ver2
StringMetaData
TraceV2
15 row(s) in 0.1490 seconds
7.初始化完成進入Hbase
./hbase shell
[email protected]0-15-ubuntu:/opt/apps/pinpoint/hbase-1.2.6/bin# ./hbase shell
2018-04-27 11:31:47,222 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 1.2.6, rUnknown, Mon May 29 02:25:32 CDT 2017
檢視目前初始化表是否存在
hbase(main):001:0> status ‘detailed’
或登入Hbase web檢視表是否初始化成功,浏覽器通路 http://X.X.X.X:16010/master-status
2.2 安裝Pinpoint Collector
1.建立目錄pinpoint-collector,解壓tomcat至該目錄下
mkdir pinpoint-collector
tar -zxvf apache-tomcat-8.5.24.tar.gz -C ./pinpoint-collector/
2.因為我們這裡pinpoint-collector、pinpoint-web安裝在同一台機器上,需要確定端口不會沖突,修改tomcat server.xml檔案
<Server port="18005" shutdown="SHUTDOWN">
<Connector port="18080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="18443" />
<!--<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />-->
3.部署pinpoint-collector-1.7.2.war到tomcat并命名為ROOT
rm -rf ./pinpoint-collector/apache-tomcat-8.5.24/webapps/*
unzip pinpoint-collector-1.7.2.war -d ./pinpoint-collector/apache-tomcat-8.5.24/webapps/ROOT/
4.修改hbase.properties(./pinpoint-collector/apache-tomcat-8.5.24/webapps/ROOT/WEB-INF/classes/ hbase.properties)
# 修改hbase位址,本機預設即可
hbase.client.host=localhost
hbase.client.port=2181
2.3 安裝Pinpoint Web
1.建立目錄pinpoint-web,解壓tomcat至該目錄下
mkdir pinpoint-web
tar -zxvf apache-tomcat-8.5.24.tar.gz -C pinpoint-web/
2.修改tomcat server.xml檔案
<Server port="28005" shutdown="SHUTDOWN">
<Connector port="28080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="28443" />
<!--<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />-->
3.部署pinpoint-web-1.7.2.war到tomcat并命名為ROOT
rm -rf ./pinpoint-web/apache-tomcat-8.5.24/webapps/*
unzip pinpoint-web-1.7.2.war -d ./pinpoint-web/apache-tomcat-8.5.24/webapps/ROOT/
4.修改hbase.properties(./pinpoint-web/apache-tomcat-8.5.24/webapps/ROOT/WEB-INF/classes/hbase.properties)
# 修改hbase位址,本機預設即可
hbase.client.host=localhost
hbase.client.port=2181
5.啟動pinpoint-collector、pinpoint-web服務
./pinpoint-collector/apache-tomcat-8.5.24/bin/startup.sh
./pinpoint-web/apache-tomcat-8.5.24/bin/startup.sh
檢視tomcat日志看服務是否啟動成功
tail -f ./pinpoint-collector/apache-tomcat-8.5.24/logs/catalina.out
tail -f ./pinpoint-web/apache-tomcat-8.5.24/logs/catalina.out
浏覽器通路:http://X.X.X.X:28080 說明服務啟動成功
2.4 安裝Pinpoint Agent
1.建立目錄pinpoint-agent,将pinpoint-agent解壓至該目錄
tar -zxvf pinpoint-agent-1.7.2.tar.gz -C ./pinpoint-agent/
2.修改配置檔案pinpoint.config
# 修改為pinpoint-collector位址,本機可不配置
profiler.collector.ip=127.0.0.1
3.添加探針有兩種方式
- 修改部署項目的tomcat啟動檔案catalina.sh,增加探針,重新開機tomcat
# 設定pinpoint-agent jar包位置
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/apps/pinpoint/pinpoint-agent/pinpoint-bootstrap-1.7.2.jar"
# 設定agent的ID
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.agentId=pp20180428"
# 設定采集項目的名稱,不能與其它項目重複
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.applicationName=demo-app"
- Spring Boot啟動
java -javaagent:/opt/apps/pinpoint/pinpoint-agent/pinpoint-bootstrap-1.7.2.jar -Dpinpoint.agentId=pp-springboot -Dpinpoint.applicationName=springboot-app -jar spring-boot-demo-0.0.1-SNAPSHOT.jar
這裡使用Spring Boot方式啟動完成之後,通路測試接口 http://X.X.X.X:8080/hello
框選右側采樣點可以檢視詳情
3 參考資料
http://naver.github.io/pinpoint/installation.html#quick-overview-of-installation
http://iamlile.github.io/2017/10/06/apm/
https://blog.csdn.net/xiaozhuanddapang/article/details/75554807
https://blog.csdn.net/mingyu1016/article/details/53925611
http://bigbully.github.io/Dapper-translation/