第四章 Docker方式安装 Pinpoint

一、需求

1.修改主机名,本地解析、yum源
2.格式化文件系统
3.docker安装
4.docker-compose的安装
5.pinpoint-apm的安装以及界面展示
6.pinpoint-agent安装

二、环境准备

主机 角色 IP
prd-apm001 Apm服务器 68.79.32.235

三、相关软件版本选择

软件名称 版本号
docker 20.10.6
git 1.8.3.1
pinpoint-apm 2.2.2
docker-compose 1.29.1
pinpoint-agnent 2.2.2

四、格式化文件系统

#1.查看所有磁盘分区情况
[root@prd-apm001 ~]$ fdisk  -l

Disk /dev/nvme1n1: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/nvme0n1: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000acf0a

        Device Boot      Start         End      Blocks   Id  System
/dev/nvme0n1p1   *        2048   104857566    52427759+  83  Linux

#2.进行磁盘分区
[root@prd-apm001 ~]$ fdisk  /dev/nvme1n1
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x39e17a4f.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-209715199, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): 
Using default value 209715199
Partition 1 of type Linux and of size 100 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

五、上传系统优化脚本

#1.编写系统优化脚本
[root@prd-apm001 ~]$ vim  Opt-Centos.sh 
#!/usr/bin/bash
# Author:jh
# Time:2021-04-11  18:48:19
# Name:Opt-Centos.sh
# Version: 1.0
# Discription: To  

local_IP=`ifconfig |awk -F ' ' 'NR==2{print $2}'`
local_hostname=`hostname`
base_yum="CentOS-Base.repo"
epel_yum="epel.repo"
yum_dir="/etc/yum.repos.d/"
cron_dir="/var/spool/cron/root"
ssh_dir="/etc/ssh/sshd_config"

linux_comm_software=(net-tools vim tree htop iftop gcc gcc-c++ glibc iotop lrzsz sl wget unzip telnet nmap nc psmisc dos2unix bash-completion bash-completion-extra sysstat rsync nfs-utils httpd-tools expect)

#1.修改主机名
source /etc/init.d/functions
if [ $# -ne 1 ];then
    echo "/bin/sh $0 New hostname"
    exit 1
fi

hostnamectl set-hostname $1
if [ $? -eq 0 ];then
    action "hostname update is" /usr/bin/true
else
    action "hostname update is" /usr/bin/false
fi

#2.配置ssh连接成功显示
platform=`uname -i`
if [ $platform != "x86_64" ];then 
    echo "this script is only for 64bit Operating System !"
    exit 1
fi
echo "the platform is ok"
cat << EOF
+---------------------------------------+
| your system is CentOS 7 x86_64 |
| start optimizing....... |
+---------------------------------------
EOF

#3.配置yum仓库
mv $yum_dir$base_yum  $yum_dir${base_yum}.bak
mv $yum_dir$epel_yum  $yum_dir${epel_yum}.bak
curl -o $yum_dir$base_yum http://mirrors.aliyun.com/repo/Centos-7.repo
curl -o $yum_dir$epel_yum http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache

#4.安装基础软件包
for i in ${linux_comm_software[*]}
do
    rpm -q $i &>/dev/null
    if [ $? -eq 0 ];then
        echo "$i is installed" 
    else
        yum -y install $i  &>/dev/null                                     
        action "$i is installing"  /usr/bin/true
    fi     
done

#5.关闭防火墙firewalld
#systemctl disable firewalld
#systemctl stop firewalld

#6.关闭selinux
#sed 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config

#7.修改本地解析
echo "$local_IP $local_hostname" >> /etc/hosts

#8.设置时间同步
timedatectl set-timezone Asia/Shanghai
/usr/sbin/ntpdate time1.aliyun.com
echo '#Timing synchronization time' >> $cron_dir
echo "* 4 * * * /usr/sbin/ntpdate time1.aliyun.com > /dev/null 2>&1" >> $cron_dir
systemctl restart crond.service

#9.ssh参数优化
#sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/g' $ssh_dir
#sed -i 's/#UseDNS yes/UseDNS no/g' $ssh_dir
#sed -i 's/PermitRootLogin yes/PermitRootLogin no/g' $ssh_dir
#sed -i 's/#port 22/poort 520/g' $ssh_dir

#10.加大文件描述符
tail -1 /etc/security/limits.conf &>/dev/null
[ $? -eq 0 ] && echo "文件描述符以加大" || echo '*               -       nofile          65535 ' >>/etc/security/limits.conf 

#11.环境变量及别名优化
cat>>/etc/profile.d/color.sh<<EOF
alias ll='ls -l --color=auto --time-style=long-iso'
PS1="\[\e[37;40m\][\[\e[32;1m\]\u\[\e[37;40m\]@\h \[\e[36;40m\]\w\[\e[0m\]]\[\e[32;1m\]\\$ \[\e[0m\]"
export HISTTIMEFORMAT='%F-%T '
EOF

source  /etc/profile

#12.内核优化
cat >>/etc/sysctl.conf<<EOF
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.ip_local_port_range = 4000    65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
net.ipv4.ip_forward = 1
net.ipv4.icmp_echo_ignore_all=1
EOF

sysctl  -p

#13.关闭NetworkManager
#systemctl  stop  NetworkManager
#systemctl  disable  NetworkManager

#14.更新软件
yum -y update && > /dev/null

#15.设置中文字符集
localectl set-locale LANG=zh_CN.UTF-8

#16.备份显示系统版本和内核的文件
cp /etc/issue{,.bak}
cp /etc/issue.net{,.bak}

> /etc/issue
> /etc/issue.net

#17.重读分区表
partprobe &&

#18.磁盘格式化
xfs_disk_info=`fdisk  -l |awk 'NR==10{print $1}'`
mkfs.xfs  $xfs_disk_info -f 

#19.新建数据目录data
mkdir /data

#20.挂载目录
mount $xfs_disk_info /data/

#21.查看挂载点
df -h

#22.实现永久挂载
uuid_disk_info=`blkid  |awk  -F ' ' 'NR==2{print $2}' |awk -F '\"' '{print $2}'`
echo "UUID=$uuid_disk_info /data                   xfs     defaults        0 0 ">>/etc/fstab

#23.查看挂载信息
tail -1 /etc/fstab

#24.优化完成    
cat << EOF
+-------------------------------------------------+
| 优 化 已 完 成                                  |
| 请 重启 这台服务器 !                            |
+-------------------------------------------------+
EOF

sleep 5

rm -rf ./Opt-Centos.sh

#2.增加执行权限
[root@prd-apm001 ~]$ chmod +x Opt-Centos.sh

#3.执行系统优化脚本
[root@prd-apm001 ~]$ sh Opt-Centos.sh

六、安装Docker

#1.编写安装docker脚本
[root@prd-apm001 ~]$ vim Ins-Docker.sh
#!/usr/bin/bash
# Author:jh
# Time:2021-04-21  11:54:22
# Name:docker_ins_apm.sh
# Version: 1.0
# Discription: To  

rely_software=(yum-utils device-mapper-persistent-data lvm2)

#1.检测系统内核版本
kernel_version=`uname -a |awk '{print $3}'|cut -d. -f1`
if [ $kernel_version -ge 3 ];then
    echo 'The System Can Install docker;' 
else
    echo 'The System Can not Install docker;';exit 
fi

#2.安装依赖软件
for i in ${rely_software[*]}
do       
    rpm -q $i &>/dev/null
    if [ $? -eq 0 ];then
        echo "$i is installed"            
    else            
        yum -y install $i  &>/dev/null                                                           
        action "$i is installing"  /usr/bin/true           
    fi                     
done

#3.添加docker镜像源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
if [ $? -eq 0 ];then
    echo "Docker Image added;" 
else 
    echo "Docker Image add failed" 
fi

#4.安装docker
yum install docker-ce -y

#5.启动docker并设置开机自启
systemctl enable --now docker
if [ $? -eq 0 ];then
    echo "Docker started;" 
else    
    echo "Docker start failed"
fi

#6.验证服务
docker_version=`docker -v |awk -F ',' '{print $1}'`

#7.设置加速器
sudo mkdir -p /etc/docker
sudo cat >/etc/docker/daemon.json <<EOF
{
      "registry-mirrors": ["https://8mh75mhz.mirror.aliyuncs.com"]
  }
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

#8.docker安装完成提示语
cat << EOF
+-------------------------------------------------+
| $docker_version 安 装 已 完 成           |
| 请 使 用 相 关 服 务 !                          |
+-------------------------------------------------+
EOF

sleep 5

mv ./Ins-Docker.sh /tmp

#2.添加执行权限
[root@prd-apm001 ~]$ chmod +x  Ins-Docker.sh

#3.运行脚本
[root@prd-apm001 ~]$ sh Ins-Docker.sh

七、拉取Pinpoint的Docker镜像(除Agent组件外)

#1.安装Git
[root@prd-apm001 ~]$ yum -y install git

#2.查看Git版本信息
[root@prd-apm001 ~]$ git --version
git version 1.8.3.1

#3.创建Git仓库目录
[root@prd-apm001 ~]$ mkdir /opt/apm

#4.初始化Git仓库
[root@prd-apm001 ~]$ cd /opt/apm
[root@prd-apm001 apm]$ git init

#5.添加pinpoint链接地址
[root@prd-apm001 apm$ git remote add origin https://github.com/naver/pinpoint-docker.git
[root@prd-apm001 apmgit clone https://github.com/naver/pinpoint-docker.git

八、安装Docker-Compose

在这里找到最新版二进制文件下载地址:https://github.com/docker/compose/releases
#1.下载docker-compose
[root@prd-apm001 ~]$ cd /usr/local/bin/
[root@prd-apm001 bin]$ wget https://github.com/docker/compose/releases/download/1.29.1/docker-compose-Linux-x86_64

#2.重命名docker-compose
[root@prd-apm001 bin]$ mv docker-compose-Linux-x86_64 docker-compose

#3.docker-compose增加执行权限
[root@prd-apm001 bin]$ chmod +x /usr/local/bin/docker-compose

九、安装Pinpoint-Apm

#1.拉取docker-compose镜像并运行pinpoint
[root@prd-apm001 /opt/apm]$ cd /opt/apm/pinpoint-docker/

[root@prd-apm001 /opt/apm/pinpoint-docker]$ ll
总用量 48
-rw-r--r-- 1 root root  8500 4月  22 10:19 docker-compose.yml
-rw-r--r-- 1 root root  8500 4月  22 10:11 docker-compose.yml.bak
drwxr-xr-x 2 root root    22 4月  22 10:11 docs
-rw-r--r-- 1 root root 11355 4月  22 10:11 License
drwxr-xr-x 3 root root    92 4月  22 10:11 pinpoint-agent
drwxr-xr-x 4 root root    32 4月  22 10:11 pinpoint-agent-attach-example
drwxr-xr-x 3 root root    92 4月  22 10:11 pinpoint-collector
drwxr-xr-x 4 root root    93 4月  22 10:11 pinpoint-flink
drwxr-xr-x 3 root root   134 4月  22 10:11 pinpoint-hbase
drwxr-xr-x 2 root root    79 4月  22 10:11 pinpoint-mysql
drwxr-xr-x 3 root root    75 4月  22 10:11 pinpoint-quickstart
drwxr-xr-x 3 root root    92 4月  22 10:11 pinpoint-web
drwxr-xr-x 2 root root    32 4月  22 10:11 pinpoint-zookeeper
-rw-r--r-- 1 root root  8694 4月  22 10:11 Readme.md

[root@prd-apm001 /opt/apm/pinpoint-docker]$ docker-compose pull && docker-compose up -d

#2.显示所有运行的容器
[root@prd-apm001 ~]$ docker ps -a
CONTAINER ID   IMAGE                                     COMMAND                  CREATED        STATUS                     PORTS                                                                                                                                                                                        NAMES
4131fab77a1c   pinpointdocker/pinpoint-quickstart        "catalina.sh run"        29 hours ago   Up 23 hours                0.0.0.0:8000->8080/tcp, :::8000->8080/tcp                                                                                                                                                    pinpoint-quickstart
0f5f24ff8255   pinpointdocker/pinpoint-agent:2.2.2       "/usr/local/bin/conf…"   29 hours ago   Up 23 hours                                                                                                                                                                                                             pinpoint-agent
39d04a65158a   pinpointdocker/pinpoint-web:2.2.2         "sh /pinpoint/script…"   29 hours ago   Up 23 hours                0.0.0.0:8079->8079/tcp, :::8079->8079/tcp, 0.0.0.0:9997->9997/tcp, :::9997->9997/tcp                                                                                                         pinpoint-web
cf96c7f9a8e9   pinpointdocker/pinpoint-collector:2.2.2   "sh /pinpoint/script…"   29 hours ago   Up 23 hours                0.0.0.0:9991-9996->9991-9996/tcp, :::9991-9996->9991-9996/tcp, 0.0.0.0:9995-9996->9995-9996/udp, :::9995-9996->9995-9996/udp                                                                 pinpoint-collector
91eac8c161bf   pinpointdocker/pinpoint-flink:2.2.2       "/docker-bin/docker-…"   29 hours ago   Up 23 hours                6123/tcp, 0.0.0.0:6121-6122->6121-6122/tcp, :::6121-6122->6121-6122/tcp, 0.0.0.0:19994->19994/tcp, :::19994->19994/tcp, 8081/tcp                                                             pinpoint-flink-taskmanager
5906d8249743   pinpointdocker/pinpoint-hbase:2.2.2       "/bin/sh -c '/usr/lo…"   29 hours ago   Up 23 hours                0.0.0.0:16010->16010/tcp, :::16010->16010/tcp, 0.0.0.0:16030->16030/tcp, :::16030->16030/tcp, 0.0.0.0:60000->60000/tcp, :::60000->60000/tcp, 0.0.0.0:60020->60020/tcp, :::60020->60020/tcp   pinpoint-hbase
b84f9bbffd33   pinpointdocker/pinpoint-flink:2.2.2       "/docker-bin/docker-…"   29 hours ago   Up 23 hours                6123/tcp, 0.0.0.0:8081->8081/tcp, :::8081->8081/tcp                                                                                                                                          pinpoint-flink-jobmanager
5fed8d8f576b   pinpointdocker/pinpoint-mysql:2.2.2       "docker-entrypoint.s…"   29 hours ago   Up 23 hours                0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                                                                                                                         pinpoint-mysql
febd0eb1465e   zookeeper:3.4                             "/docker-entrypoint.…"   29 hours ago   Up 23 hours                2888/tcp, 3888/tcp, 0.0.0.0:49161->2181/tcp, :::49161->2181/tcp                                                                                                                              pinpoint-docker_zoo3_1
c045bbbc9ca0   zookeeper:3.4                             "/docker-entrypoint.…"   29 hours ago   Up 23 hours                2888/tcp, 3888/tcp, 0.0.0.0:49159->2181/tcp, :::49159->2181/tcp                                                                                                                              pinpoint-docker_zoo1_1
e7371be2f855   zookeeper:3.4                             "/docker-entrypoint.…"   29 hours ago   Up 23 hours                2888/tcp, 3888/tcp, 0.0.0.0:49160->2181/tcp, :::49160->2181/tcp                                                                                                                              pinpoint-docker_zoo2_1
381d7aa6a4d9   68c42c793dd4                              "/bin/sh -c 'apt-get…"   29 hours ago   Exited (35) 29 hours ago                                                                                                                                                                                                sad_ramanujan
98ebc64890b3   68c42c793dd4                              "/bin/sh -c 'apt-get…"   29 hours ago   Exited (35) 29 hours ago                                                                                                                                                                                                affectionate_black

#3.显示docker-compose运行的所有服务
[root@prd-apm001 /opt/apm/pinpoint-docker]$ docker-compose ps
           Name                         Command               State                                 Ports                              
---------------------------------------------------------------------------------------------------------------------------------------
pinpoint-agent               /usr/local/bin/configure-a ...   Up                                                                       
pinpoint-collector           sh /pinpoint/scripts/start ...   Up      0.0.0.0:9991->9991/tcp,:::9991->9991/tcp,                        
                                                                      0.0.0.0:9992->9992/tcp,:::9992->9992/tcp,                        
                                                                      0.0.0.0:9993->9993/tcp,:::9993->9993/tcp,                        
                                                                      0.0.0.0:9994->9994/tcp,:::9994->9994/tcp,                        
                                                                      0.0.0.0:9995->9995/tcp,:::9995->9995/tcp,                        
                                                                      0.0.0.0:9995->9995/udp,:::9995->9995/udp,                        
                                                                      0.0.0.0:9996->9996/tcp,:::9996->9996/tcp,                        
                                                                      0.0.0.0:9996->9996/udp,:::9996->9996/udp                         
pinpoint-docker_zoo1_1       /docker-entrypoint.sh zkSe ...   Up      0.0.0.0:49159->2181/tcp,:::49159->2181/tcp, 2888/tcp, 3888/tcp   
pinpoint-docker_zoo2_1       /docker-entrypoint.sh zkSe ...   Up      0.0.0.0:49160->2181/tcp,:::49160->2181/tcp, 2888/tcp, 3888/tcp   
pinpoint-docker_zoo3_1       /docker-entrypoint.sh zkSe ...   Up      0.0.0.0:49161->2181/tcp,:::49161->2181/tcp, 2888/tcp, 3888/tcp   
pinpoint-flink-jobmanager    /docker-bin/docker-entrypo ...   Up      6123/tcp, 0.0.0.0:8081->8081/tcp,:::8081->8081/tcp               
pinpoint-flink-taskmanager   /docker-bin/docker-entrypo ...   Up      0.0.0.0:19994->19994/tcp,:::19994->19994/tcp,                    
                                                                      0.0.0.0:6121->6121/tcp,:::6121->6121/tcp,                        
                                                                      0.0.0.0:6122->6122/tcp,:::6122->6122/tcp, 6123/tcp, 8081/tcp     
pinpoint-hbase               /bin/sh -c /usr/local/bin/ ...   Up      0.0.0.0:16010->16010/tcp,:::16010->16010/tcp,                    
                                                                      0.0.0.0:16030->16030/tcp,:::16030->16030/tcp,                    
                                                                      0.0.0.0:60000->60000/tcp,:::60000->60000/tcp,                    
                                                                      0.0.0.0:60020->60020/tcp,:::60020->60020/tcp                     
pinpoint-mysql               docker-entrypoint.sh mysqld      Up      0.0.0.0:3306->3306/tcp,:::3306->3306/tcp, 33060/tcp              
pinpoint-quickstart          catalina.sh run                  Up      0.0.0.0:8000->8080/tcp,:::8000->8080/tcp                         
pinpoint-web                 sh /pinpoint/scripts/start ...   Up      0.0.0.0:8079->8079/tcp,:::8079->8079/tcp,                        
                                                                      0.0.0.0:9997->9997/tcp,:::9997->9997/tcp                         
                                                                      
#4.docker-compose常用命令
docker-compose -h                           # 查看帮助

docker-compose up                           # 创建并运行所有容器
docker-compose up -d                        # 创建并后台运行所有容器
docker-compose -f docker-compose.yml up -d  # 指定模板
docker-compose down                         # 停止并删除容器、网络、卷、镜像。

docker-compose logs       # 查看容器输出日志
docker-compose pull       # 拉取依赖镜像
dokcer-compose config     # 检查配置
dokcer-compose config -q  # 检查配置,有问题才有输出

docker-compose restart   # 重启服务
docker-compose start     # 启动服务
docker-compose stop      # 停止服务   
docker-compose kill		 # kill服务
docker-compose rm		# 删除服务

十、使用浏览器访问各组件

#1.Flink组件
http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8081

#2.WebUI   
http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8079

#3.QuickStart
http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8000/

#4.Hbase   
http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8000/16010

#1.使用浏览器访问Flink:http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8081

#2.将Github上https://github.com/pinpoint-apm/pinpoint/releases/tag/的pinpoint-flink-job-{pinpoint-version}.jar 文件手动upload到flik组件中,上传的版本{pinpoint-version}需要和pinpoint保持一致,pinpoint版本可以查看镜像或者容器版本

#3.上传完成

十二、被监控端安装Agent组件

1.下载agent组件

#1.在需要监控的服务器上访问 https://github.com/pinpoint-apm/pinpoint/releases/tag/v2.2.2 下载和 Collector组件 相同版本的pinpoint-agent压缩包。

2.测试与APM服务器之间连通性

#使用telnet测试如下ip的连通性,出现以下显示表示telnet连通性没有问题。
[root@prd-databridge001 release]# telnet 172.31.43.41 8079
Trying 172.31.43.41...
Connected to 172.31.43.41.
Escape character is '^]'.

[root@prd-databridge001 release]# telnet 172.31.43.41 9997
Trying 172.31.43.41...
Connected to 172.31.43.41.
Escape character is '^]'.

3.上传pinpoint-agent包

#1.新建文件夹用来存放pinpoint-agent包
[root@prd-databridge001 ~]# mkdir /opt/pinpoint-agent

#2.上传pinpoint-agent包(上传方式自己随意,这边采用rz上传)
[root@prd-databridge001 ~]# cd /opt/pinpoint-agent/
[root@prd-databridge001 ~]# rz
[root@prd-databridge001 pinpoint-agent]# ll
-rw-r--r-- 1 root root 26032318 4月  22 06:21 pinpoint-agent-2.2.2.tar.gz

#3.解压压缩包
[root@prd-databridge001 pinpoint-agent]# unzip pinpoint-agent-2.2.2.tar.gz
[root@prd-databridge001 pinpoint-agent]# ll
drwxrwxr-x 9 root root      257 4月  22 04:33 pinpoint-agent-2.2.2
-rw-r--r-- 1 root root 26032318 4月  22 06:21 pinpoint-agent-2.2.2.tar.gz

#4.修改文件所属主和所属组权限
[root@prd-databridge001 pinpoint-agent]# cd ..
[root@prd-databridge001 opt]# chmod -R 777 pinpoint-agent

4.修改配置文件

#1.修改pinpoint.config 文件
[root@prd-databridge001 opt]# cd pinpoint-agent/pinpoint-agent-2.2.2/profiles/release/
[root@prd-databridge001 release]# ll
总用量 100
-rwxrwxrwx 1 root root  2699 3月   5 05:40 log4j2.xml
-rwxrwxrwx 1 root root 48578 4月  22 08:06 pinpoint.config
-rwxrwxrwx 1 root root 48569 4月  22 04:32 pinpoint.config.bak
[root@prd-databridge001 release]# vim pinpoint.config
profiler.transport.grpc.collector.ip=pinpoint服务器ip
profiler.collector.ip=pinpoint服务器ip
profiler.sampling.rate=2

5.应用程序添加APM监控启动步骤

#1.使用如下命令启动jar包:
java -javaagent:pinpoint-agent所在的绝对路径 -Dpinpoint.agentId=名称 -Dpinpoint.applicationName=名称 -jar xxxxxxxxxx.jar

#2.注意:
applicationName:在pinpoint上显示的名字
agentId:可以和applicationName相同,也可以不同。但必须唯一,标志一个jvm。
同一个应用的不同实例可以使用不同的agentId,相同的applicationName。

#3.举例:
java -javaagent:/opt/pinpoint-agent/pinpoint-agent-2.2.2/pinpoint-bootstrap-2.2.2.jar -Dpinpoint.agentId=sso_test -Dpinpoint.applicationName=sso_test -jar xxxxxxxxxx.jar

#4.后台启动:
nohup  java -javaagent:/opt/pinpoint-agent/pinpoint-agent-2.2.2/pinpoint-bootstrap-2.2.2.jar -Dpinpoint.agentId=sso_test -Dpinpoint.applicationName=sso_test -jar xxxxxxxxxx.jar &

十三、查看监控效果

#1.使用浏览器访问http://ec2-68-79-32-235.cn-northwest-1.compute.amazonaws.com.cn:8079查看配置已生效

posted @ 2021-06-25 11:09  年少纵马且长歌  阅读(1747)  评论(0编辑  收藏  举报