官网
bash
## 官网地址:
skywalking.apache.org/
## 中文文档地址:
https://skyapm.github.io/document-cn-translation-of-skywalking/
## 下载地址
https://skywalking.apache.org/downloads/
参考
bash
##
https://blog.csdn.net/qq_45518774/article/details/128798893
##
https://zhuanlan.zhihu.com/p/346605953
安装
ES作为后端存储
bash
## 官网下载
wget https://dlcdn.apache.org/skywalking/9.3.0/apache-skywalking-apm-9.3.0.tar.gz
wget https://dlcdn.apache.org/skywalking/java-agent/8.14.0/apache-skywalking-java-agent-8.14.0.tgz
## 后端存储选择ES
elasticsearch-7.17.9-linux-x86_64.tar.gz
前置操作
vi /etc/security/limits.conf
bash
* soft nofile 640000
* hard nofile 640000
* soft nproc 640000
* hard nproc 640000
vi /etc/sysctl.conf
bash
vm.max_map_count=655360
配置
vim /opt/app/skywalking/config/application.yml
bash
node.master: true
node.data: true
node.name: node-01
path.data: /opt/data/es/data
path.logs: /opt/data/es/logs
network.host: 0.0.0.0
http.port: 9200
## 支持跨域访问
http.cors.enabled: true
启动:
bash
#以es用户启动
groupadd es
useradd es -g es -p es
##
chown -R es:es /opt/data/es/
开启启动
cat /etc/systemd/system/elastic.service
bash
[Unit]
Description=elasticsearch
[Service]
Type=forking
User=es
LimitNOFILE=65536
LimitNPROC=65536
ExecStart=/opt/app/elastic/bin/elasticsearch -d
[Install]
WantebBy=multi-user.target
编辑Skywalking配置文件
vi /opt/app/skywalking/config/application.yml
bash
storage:
#selector: ${SW_STORAGE:h2}
selector: ${SW_STORAGE:elasticsearch}
elasticsearch:
namespace: ${SW_NAMESPACE:"apm-es"} # 表示es的索引
clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:10.1.1.32:9200}
protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
connectTimeout: ${SW_STORAGE_ES_CONNECT_TIMEOUT:3000}
socketTimeout: ${SW_STORAGE_ES_SOCKET_TIMEOUT:30000}
responseTimeout: ${SW_STORAGE_ES_RESPONSE_TIMEOUT:15000}
numHttpClientThread: ${SW_STORAGE_ES_NUM_HTTP_CLIENT_THREAD:0}
user: ${SW_ES_USER:""}
password: ${SW_ES_PASSWORD:""}
启动
bash
#
../bin/startup.sh
Mysql作为后端存储
vi /opt/app/skywalking/config/application.yml
bash
storage:
#selector: ${SW_STORAGE:h2}
selector: ${SW_STORAGE:mysql}
..............................
mysql:
properties:
jdbcUrl: ${SW_JDBC_URL:"jdbc:mysql://localhost:3306/db_apm?rewriteBatchedStatements=true"}
dataSource.user: ${SW_DATA_SOURCE_USER:root}
dataSource.password: ${SW_DATA_SOURCE_PASSWORD:root@1234}
依赖包
官方是没有mysql的包的。去下载:
bash
###
create database db_apm;
## 依赖驱动包下载地址
https://mvnrepository.com/artifact/mysql/mysql-connector-java/8.0.28
##
mysql-connector-java-8.0.28.jar
## jar放到以下目录
/opt/app/skywalking/oap-libs/
客户端接入
Java-agent
vim /media/agent/skywalking-agent/config/agent.config
bash
##
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:10.1.1.32:11800}
加载agent
bash
##
tar -xzvf apache-skywalking-apm-9.3.0.tar.gz
tar -zxvf apache-skywalking-java-agent-8.15.0.tgz
# 每个项目需要拷贝一份skywalking-agent.jar
java -jar -javaagent:/media/agent/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=demo /opt/app/java-demo/demo.jar
#或者
java -jar -javaagent:/media/agent/skywalking-agent/skywalking-agent.jar -DSW_AGENT_NAME=ke-demo-test /opt/app/java-demo/demo.jar
## 或者
# java -javaagent:/skywalking-agent/skywalking-agent.jar \
-DSW_AGENT_NAMESPACE=xyz \
-DSW_AGENT_NAME=abc-application \
-Dskywalking.collector.backend_service=skywalking.abc.xyz.com:11800 \
-jar abc-xyz-1.0-SNAPSHOT.jar