pinpoin監控安裝

Pinpoint是什麼
簡單的說,Pinpoint是一款對Java編寫的大規模分佈式系統的APM工具,有些人也喜歡稱呼這類工具爲調用鏈系統、分佈式跟蹤系統。我們知道,前端向後臺發起一個查詢請求,後臺服務可能要調用多個服務,每個服務可能又會調用其它服務,最終將結果返回,彙總到頁面上。如果某個環節發生異常,工程師很難準確定位這個問題到底是由哪個服務調用造成的,Pinpoint等相關工具的作用就是追蹤每個請求的完整調用鏈路,收集調用鏈路上每個服務的性能數據,方便工程師能夠快速定位問題。它對性能的影響最小(只增加約3%資源利用率),安裝agent是無侵入式的

爲什麼要用Pinpoint
最重要的原因,對代碼的零侵入,運用JavaAgent字節碼增強技術,只需要加啓動參數即可。

Pinpoint-Collector:收集各種性能數據
Pinpoint-Agent:和自己運行的應用關聯起來的探針
Pinpoint-Web:將收集到的數據顯示成WEB網頁形式
HBase Storage:收集到的數據存到HBase中

部署:
1臺Web,安裝好jdk,tomcat
2臺collector,安裝jdk,tomcat
1臺hbase ,安裝好jdk,hbase必須給大點的存儲,目前我掛的是300G的硬盤,預生產環境比較小,後面根據實際情況調整
War包下載:
https://github.com/naver/pinpoint/releases
https://github.com/phoenix002/pinpoint/blob/master/hbase/scripts/hbase-create.hbase
官方安裝文檔:https://naver.github.io/pinpoint/installation.html

pinpoint-hbase
[root@pinpoint-hbase ]#df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda1 ext4 20G 2.1G 17G 12% /
devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs tmpfs 3.9G 8.4M 3.9G 1% /run
tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sdb1 xfs 300G 37M 300G 1% /opt/hbase-data
tmpfs tmpfs 783M 0 783M 0% /run/user/0

[root@pinpoint-hbase ]#cat /ect/fstab
UUID=db3db1ea-0791-44ed-97ca-b59616152f19 /opt/hbase-data xfs defaults 0 0
https://www.cnblogs.com/sfissw/p/7900284.html

reboot之前記得mount -a 一下

[root@pinpoint-hbase ]#cat /etc/hosts
172.16.41.79 pinpoint-hbase

[root@pinpoint-hbase conf]#cat hbase-env.sh | grep -v "^#" | grep -v "^$"
export JAVA_HOME=/opt/jdk
export HBASE_HEAPSIZE=6G
export HBASE_OPTS="-XX:+UseConcMarkSweepGC"
export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"
export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -XX:PermSize=128m -XX:MaxPermSize=128m"

[root@pinpoint-hbase conf]# cat hbase-site.xml | grep -v "^#" | grep -v "^$"
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///opt/hbase-data</value>
</property>
</configuration>

[root@pinpoint-hbase bin]# cd /opt/hbase/bin
[root@pinpoint-hbase bin]# ./start-hbase.sh

[root@pinpoint-hbase bin]# jps
27586 HMaster
1174 Jps

[root@pinpoint-hbase opt]# ll
total 28
drwxr-xr-x 8 root root 4096 Jul 4 08:44 hbase
-rw-r--r-- 1 root root 15763 Jul 2 15:57 hbase-create.hbase
drwxr-xr-x 9 root root 137 Jul 4 14:48 hbase-data
drwxr-xr-x 8 root root 4096 Jul 4 08:37 jdk

初始化pinpoint數據庫
./hbase shell /opt/hbase-create.hbase
pinpoin監控安裝

./hbase shell 查看數據庫是否初始化成功:
輸入status 'detailed'查看剛纔初始化的表,是否存在
hbase(main):001:0> status 'detailed'

[root@pinpoint-hbase bin]# netstat -antp|grep LIST
tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 710/sshd
tcp6 0 0 :::16010 :::
LISTEN 27586/java
tcp6 0 0 172.16.41.79:60204 ::: LISTEN 27586/java
tcp6 0 0 172.16.41.79:42925 :::
LISTEN 27586/java
tcp6 0 0 :::60435 ::: LISTEN 27586/java
tcp6 0 0 :::22 :::
LISTEN 710/sshd
tcp6 0 0 :::2181 :::* LISTEN 27586/java

hbase頁面查看:http://172.16.41.79:16010/master-status

Pinpoint-web
[root@Pinpoint-web classes]#/opt/tomcat-pinpoint-web/webapps/ROOT/WEB-INF/classes**

cat hbase.properties | grep -v "^#" | grep -v "^$"
hbase.client.host=pinpoint-hbase
hbase.client.port=2181
hbase.zookeeper.znode.parent=/hbase
hbase.namespace=default
hbase.ipc.client.tcpnodelay=true
hbase.rpc.timeout=10000
hbase.client.operation.timeout=10000
hbase.ipc.client.socket.timeout.read=20000
hbase.ipc.client.socket.timeout.write=30000
hbase.client.thread.max=64
hbase.client.threadPool.queueSize=5120
hbase.client.threadPool.prestart=false
hbase.client.parallel.scan.enable=true
hbase.client.parallel.scan.maxthreads=64
hbase.client.parallel.scan.maxthreadsperscan=16

[root@Pinpoint-web classes]#cat pinpoint-web.properties | grep -v "^#" | grep -v "^$"
cluster.enable=true
cluster.web.tcp.port=9997
cluster.zookeeper.address=172.16.41.79:2181
cluster.zookeeper.sessiontimeout=30000
cluster.zookeeper.retry.interval=60000
cluster.connect.address=
admin.password=admin
config.sendUsage=true
config.editUserInfo=true
config.openSource=true
config.show.activeThread=true
config.show.activeThreadDump=true
config.enable.activeThreadDump=true
config.show.applicationStat=false
config.enable.serverMapRealTime=true
web.hbase.selectSpans.limit=500
web.hbase.selectAllSpans.limit=500
web.activethread.activeAgent.duration.days=7
web.servermap.creator.worker.threadSize=32
web.servermap.creator.worker.queueSize=1024
web.servermap.appender.worker.threadSize=32
web.servermap.appender.worker.queueSize=1024
websocket.allowedOrigins=
web.installation.pinpointVersion=
web.installation.downloadUrl=
**

cat /etc/hosts
172.16.41.79 pinpoint-hbase

[root@Pinpoint-web classes]# netstat -antp|grep LIST
tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 689/sshd
tcp6 0 0 :::8010 :::
LISTEN 15120/java
tcp6 0 0 172.16.41.78:9997 ::: LISTEN 15120/java
tcp6 0 0 :::8081 :::
LISTEN 15120/java
tcp6 0 0 :::22 ::: LISTEN 689/sshd
tcp6 0 0 127.0.0.1:8006 :::
LISTEN 15120/java

Pinpoint-collector-2
[root@Pinpoint-collector-2 webapps]# cat /etc/hosts
172.16.41.79 pinpoint-hbase

[root@Pinpoint-collector-2 classes]# pwd
/opt/tomcat-pinpoint-collector/webapps/pinpoint-collector-1.7.2/WEB-INF/classes
[root@Pinpoint-collector-2 classes]# cat hbase.properties | grep -v "^#" | grep -v "^$"
hbase.client.host=pinpoint-hbase
hbase.client.port=2181
hbase.zookeeper.znode.parent=/hbase
hbase.namespace=default
hbase.ipc.client.tcpnodelay=true
hbase.rpc.timeout=10000
hbase.client.operation.timeout=10000
hbase.ipc.client.socket.timeout.read=20000
hbase.ipc.client.socket.timeout.write=60000
hbase.client.thread.max=64
hbase.client.threadPool.queueSize=5120
hbase.client.threadPool.prestart=false
hbase.client.async.enable=false
hbase.client.async.in.queuesize=10000
hbase.client.async.flush.period.ms=100
hbase.client.async.max.retries.in.queue=10
[root@Pinpoint-collector-2 classes]#

[root@Pinpoint-collector-2 classes]# cat pinpoint-collector.properties | grep -v "^#" | grep -v "^$"
collector.receiver.base.ip=0.0.0.0
collector.receiver.base.port=9994
collector.receiver.base.worker.threadSize=8
collector.receiver.base.worker.queueSize=1024
collector.receiver.base.worker.monitor=true
collector.receiver.stat.udp=true
collector.receiver.stat.udp.ip=0.0.0.0
collector.receiver.stat.udp.port=9995
collector.receiver.stat.udp.receiveBufferSize=4194304
collector.receiver.stat.tcp=false
collector.receiver.stat.tcp.ip=0.0.0.0
collector.receiver.stat.tcp.port=9995
collector.receiver.stat.worker.threadSize=8
collector.receiver.stat.worker.queueSize=64
collector.receiver.stat.worker.monitor=true
collector.receiver.span.udp=true
collector.receiver.span.udp.ip=0.0.0.0
collector.receiver.span.udp.port=9996
collector.receiver.span.udp.receiveBufferSize=4194304
collector.receiver.span.tcp=false
collector.receiver.span.tcp.ip=0.0.0.0
collector.receiver.span.tcp.port=9996
collector.receiver.span.worker.threadSize=32
collector.receiver.span.worker.queueSize=256
collector.receiver.span.worker.monitor=true
collector.l4.ip=
collector.agentEventWorker.threadSize=4
collector.agentEventWorker.queueSize=1024
statistics.flushPeriod=1000
cluster.enable=true
cluster.zookeeper.address=172.16.41.79:2181
cluster.zookeeper.sessiontimeout=30000
cluster.listen.ip=
cluster.listen.port=
collector.spanEvent.sequence.limit=10000
flink.cluster.enable=false
flink.cluster.zookeeper.address=localhost
flink.cluster.zookeeper.sessiontimeout=3000
[root@Pinpoint-collector-2 classes]#

[root@Pinpoint-collector-2 classes]# netstat -antp|grep LIST
tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 681/sshd
tcp6 0 0 :::8009 :::
LISTEN 20226/java
tcp6 0 0 :::9994 ::: LISTEN 20226/java
tcp6 0 0 :::8080 :::
LISTEN 20226/java
tcp6 0 0 :::22 ::: LISTEN 681/sshd
tcp6 0 0 127.0.0.1:8005 :::
LISTEN 20226/java

web程序部署:
IP=ifconfig|grep inet|grep 10.68|awk '{print $2}'|awk -F '.' '{print $3"."$4}'
CATALINA_OPTS="$JAVA_OPTS -javaagent:/opt/pinpoint-agent/pinpoint-bootstrap-1.7.1.jar -Dpinpoint.agentId=srm-api-war-${IP} -Dpinpoint.applicationName=srm-api-war"

dubbo程序部署:
IP=ifconfig|grep inet|grep 10.68|awk '{print $2}'|awk -F '.' '{print $3"."$4}'
J_OPTS="-javaagent:/opt/pinpoint-agent/pinpoint-bootstrap-1.7.1.jar -Dpinpoint.agentId=srm-opsearchdata-${IP} -Dpinpoint.applicationName=srm-op-searchdata"

pinpoin監控安裝

參考資料:
https://github.com/naver/pinpoint
http://www.cnblogs.com/yyhh/p/6106472.html#yy0301
https://github.com/ameizi/DevArticles/issues/166
https://blog.csdn.net/huashao0602/article/details/75271599
http://www.herohuang.com/2017/03/01/apm-pinpoint/
https://my.oschina.net/u/3201295/blog/834844
https://blog.csdn.net/wslyk606/article/details/77752467

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章