Skywalking原理学习 -- skywalking 搭建及入门示例

什么是 SkyWalking
SkyWalking 是观察性分析平台和应用性能管理系统。
提供分布式追踪、服务网格遥测分析、度量聚合和可视化一体化解决方案。官网介绍地址
架构:
Skywalking原理学习 -- skywalking 搭建及入门示例_第1张图片

环境搭建

安装下载部署

1、下载
地址:http://skywalking.apache.org/zh/downloads/
Skywalking原理学习 -- skywalking 搭建及入门示例_第2张图片
2、安装
下载解压后目录如下:
Skywalking原理学习 -- skywalking 搭建及入门示例_第3张图片
不需要修改配置文件,在bin目录下执行startup.bat或startup.sh即可启动服务:
Skywalking原理学习 -- skywalking 搭建及入门示例_第4张图片
执行startup.bat之后会启动如下两个服务:
(1)Skywalking-Collector:追踪信息收集器,通过 gRPC/Http 收集客户端的采集信息 ,Http默认端口 12800,gRPC默认端口 11800。
(2)Skywalking-Webapp:管理平台页面 默认端口 8080,登录信息 admin/admin

3、配置信息
(1)收集器相关配置:支持 http/gRPC收集

core:
  default:
    restHost: ${SW_CORE_REST_HOST:0.0.0.0}
    restPort: ${SW_CORE_REST_PORT:12800}
    restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/}
    gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0}
    gRPCPort: ${SW_CORE_GRPC_PORT:11800}
    downsampling:
    - Hour
    - Day
    - Month
    # Set a timeout on metric data. After the timeout has expired, the metric data will automatically be deleted.
    recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute
    minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute
    hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour
    dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day
    monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month

(2)收集信息存储:支持h2和 ES

storage:
  h2:
    driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource}
    url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db}
    user: ${SW_STORAGE_H2_USER:sa}
#  elasticsearch:
#    # nameSpace: ${SW_NAMESPACE:""}
#    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9200}
#    indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
#    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
#    # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html
#    bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests
#    bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb
#    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

(3)可采集信息:jvm运行相关信息,zipkin追踪日志等。

receiver-register:
  default:
receiver-trace:
  default:
    bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/}  # Path to trace buffer files, suggest to use absolute path
    bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
    bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
    bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
    sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default.
receiver-jvm:
  default:
#service-mesh:
#  default:
#    bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/}  # Path to trace buffer files, suggest to use absolute path
#    bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB
#    bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB
#    bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false}
#istio-telemetry:
#  default:
#receiver_zipkin:
#  default:
#    host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0}
#    port: ${SW_RECEIVER_ZIPKIN_PORT:9411}
#    contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/}

页面介绍

1、首页:
Skywalking原理学习 -- skywalking 搭建及入门示例_第5张图片
2、调用关系
Skywalking原理学习 -- skywalking 搭建及入门示例_第6张图片
3、服务调用信息
Skywalking原理学习 -- skywalking 搭建及入门示例_第7张图片
4、追踪日志信息
Skywalking原理学习 -- skywalking 搭建及入门示例_第8张图片

Agent 使用示例

Skywalking 采用 Java 探针技术(java agent 博客),对客户端应用程序没有任何代码侵入,使用起来简单方便,当然其具体实现就是需要针对不同的框架及服务提供探针插件。
使用命令:

java -javaagent:G:\github\incubator-skywalking\skywalking-agent\skywalking-agent.jar
-Dskywalking.agent.service_name=test  -jar app.jar

这样就可以完成对目前应用 app.jar 的监控

Tomcat 监控

Tomcat 7 修改tomcat/bin/catalina.sh,在首行加入如下信息

CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/skywalking-agent/skywalking-agent.jar"; export CATALINA_OPTS

Tomcat 8 修改tomcat/bin/catalina.sh,在首行加入如下信息

set "CATALINA_OPTS=... -javaagent:E:\apache-tomcat-8.5.20\skywalking-agent\skywalking-agent.jar"

你可能感兴趣的:(分布式系统,--,追踪系统)