1. 安装
8.0版本的UI 改为自定义查询语句,需要配置定制化图表,所以暂时使用7.0版本。
8.x版本后会增加kafka数据传输特性,可以解决异地机房部署问题,目前2020-06暂未发布。
elasticsearch 安装参考:https://blog.csdn.net/zimou5581/article/details/106782184
# 安装jdk,略
# 下载安装
wget https://mirrors.tuna.tsinghua.edu.cn/apache/skywalking/7.0.0/apache-skywalking-apm-es7-7.0.0.tar.gz
tar zxf apache-skywalking-apm-es7-7.0.0.tar.gz
mv apache-skywalking-apm-es7 skywalking-es7-7.0
# 修改配置,使用 elasticsearch7 作为存储
cd skywalking-es7-7.0
vim config/application.yml
storage:
selector: ${SW_STORAGE:elasticsearch7}
elasticsearch7:
nameSpace: ${
SW_NAMESPACE:"skywalking"}
recordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day
otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:7} # Unit is day
monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:3} # Unit is month
bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:1000} # Execute the bulk every 1000 requests
flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests
concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests
:wq
# 增加自定义插件配置(没有自定义插件的可以忽略)
vim config/component-libraries.yml
Candy:
id: 1001
languages: Java
:wq
# 启动
./bin/startup.sh
# 停止
/opt/stopByName.sh skywalking
# 查询分片数据
curl -XGET http://localhost:9200/_cat/shards?v
# (特殊需要时使用)清空skywalking在es里的索引和数据
curl -XDELETE http://localhost:9200/skywalking*
2. 应用接入
<!-- pom.xml 增加skywalking日志依赖 -->
<dependency>
<groupId>org.apache.skywalking</groupId>
<artifactId>apm-toolkit-logback-1.x</artifactId>
<version>7.0.0</version>
</dependency>
<!-- logback.xml 增加tid,控制台和日志文件 -->
<encoder charset="UTF-8" class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout">
<pattern>[%tid] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level logger_name:%logger{36} [%thread] %-5level %msg%n</pattern>
</layout>
</encoder>
3. 应用启动
# 修改agent配置
vim ./agent/config/agent.config
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:192.168.57.91:11800}
:wq
# 插件放入/agent/plugins目录,应用增加jvm参数
java -jar app.jar -DSW_AGENT_NAME=hello -javaagent:/opt/skywalking-apm-bin/agent/skywalking-agent.jar
容量规划参考:https://blog.csdn.net/flysqrlboy/article/details/89009200
配置调优参考:https://blog.csdn.net/smooth00/article/details/96479544
官方网站:http://skywalking.apache.org/zh/
Github主页:https://github.com/apache/skywalking
中文文档:https://skyapm.github.io/document-cn-translation-of-skywalking/zh/master/guides/
中文文档(github访问困难):http://itmuch.com/books/skywalking/
如何构建:https://skyapm.github.io/document-cn-translation-of-skywalking/zh/master/guides/How-to-build.html
插件列表:https://skyapm.github.io/document-cn-translation-of-skywalking/zh/master/setup/service-agent/java-agent/Supported-list.html
第三方插件:https://github.com/SkyAPM/java-plugin-extensions (oracle等、)
插件开发指南:https://skyapm.github.io/document-cn-translation-of-skywalking/zh/master/guides/Java-Plugin-Development-Guide.html
视频分享:http://www.itdks.com/ActivityC/search?keyWord=skywalking
视频教程:https://search.bilibili.com/all?keyword=skywalking