环境:
Centos 7.4 X64
IP:192.168.1.11
1、配置环境,先安装jdk
到Oracle官网下载安装JDK
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
上传到系统并安装
[root@k1 ~]# rpm -ivh jdk-8u121-linux-x64.rpm
[root@k1 ~]# java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
2、安装Hbase
到Oracle官网下载Hbase
https://hbase.apache.org/downloads.html
这里最新版是2.1.3
下载
[root@k1 ~]# wget http://mirrors.shu.edu.cn/apache/hbase/2.1.3/hbase-2.1.3-bin.tar.gz
#解压
[root@k1 ~]# tar -xzf hbase-2.1.3-bin.tar.gz
#移动到安装目录
[root@k1 ~]# mv hbase-2.1.3 /usr/local/hbase
修改Hbase环境配置,设置JAVA_HOME路径
[root@k1 ~]# vim /usr/local/hbase/conf/hbase-env.sh
export JAVA_HOME=/usr/java/jdk1.8.0_121/
#在之间添加以下配置
[root@k1 ~]# vim /usr/local/hbase/conf/hbase-site.xml
zookeeper.znode.parent
/hbase
#启动hbase
[root@k1 ~]# /usr/local/hbase/bin/start-hbase.sh
running master, logging to /usr/local/hbase/bin/../logs/hbase-root-master-k1.out
打开16010端口,就能看到hbase数据库服务的web界面了
http://192.168.1.11:16010/
3、安装pinpoint组件
打开pinpoint的github地址
https://github.com/naver/pinpoint
找到代码里面的hbase/scripts/hbase-create.hbase 文件,下载下来有用
再到https://github.com/naver/pinpoint/releases/tag/1.8.1 里面找到编译好的war包和agent,下载下来
[root@k1 ~]# wget https://github.com/naver/pinpoint/releases/download/1.8.1/pinpoint-web-1.8.1.war
[root@k1 ~]# wget https://github.com/naver/pinpoint/releases/download/1.8.1/pinpoint-collector-1.8.1.war
[root@k1 ~]# wget https://github.com/naver/pinpoint/releases/download/1.8.1/pinpoint-agent-1.8.1.tar.gz
#初始化hbase
[root@k1 ~]# /usr/local/hbase/bin/hbase shell hbase-create.hbase
Created table AgentInfo
Took 5.5844 seconds
Created table AgentStatV2
Took 4.3817 seconds
............
#再去下载一个tomcat
[root@k1 ~]# wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.5.38/bin/apache-tomcat-8.5.38.tar.gz
#解压
[root@k1 ~]# tar -xzf apache-tomcat-8.5.38.tar.gz
#放到安装目录
[root@k1 ~]# mv apache-tomcat-8.5.38 /usr/local/tomcat
#移动war包到tomcat 的webapps目录
[root@k1 ~]# mv pinpoint-*.war /usr/local/tomcat/webapps/
#启动tomcat
[root@k1 ~]# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
启动成功,打开http://192.168.1.11:8080/pinpoint-web-1.8.1 网址就能看到pinpoint的监控页面了
此时的监控是没有任何数据的
4、监控tomcat
下面我们来安装监控tomat 的agent
把pinpoint-agent移动到安装目录并解压
[root@k1 ~]# mkdir /usr/local/pinpoint-agent
[root@k1 ~]# mv pinpoint-agent-1.8.1.tar.gz /usr/local/pinpoint-agent/
[root@k1 pinpoint-agent]# tar -xzf pinpoint-agent-1.8.1.tar.gz
#修改tomcat配置
[root@k1 pinpoint-agent]# vim /usr/local/tomcat/bin/catalina.sh
#后面接agent的时间目录文件
JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/pinpoint-agent/pinpoint-bootstrap-1.8.1.jar"
JAVA_OPTS="$JAVA_OPTS -Dpinpoint.agentId=APM-104"
#显示的监控名字
JAVA_OPTS="$JAVA_OPTS -Dpinpoint.applicationName=tomcat8"
重启tomcat
[root@k1 pinpoint-agent]# /usr/local/tomcat/bin/shutdown.sh
[root@k1 pinpoint-agent]# /usr/local/tomcat/bin/startup.sh
选中tomcat8查看,可以看到有45个成功的请求
完成