美文网首页
分布式skywalking链路追踪详细教程

分布式skywalking链路追踪详细教程

作者: 月下饿狼 | 来源:发表于2020-09-06 23:12 被阅读0次

skywalking是什么?

Skywalking 是一个分布式追踪(Trace)系统。除了 Skywalking 之外,比较出名的分布式追踪系统还有 Dapper、鹰眼、Pinpoint 、Zipkin等等。

skywalking 架构

springboot项目如何集成skywalking

首先搭建环境

1.linux系统(安装jdk)这个就不多说了
配置linux需要的环境
内存 3G, 处理器数量 2 (提高下性能)


1.1 修改系统限制配置
vi /etc/security/limits.conf
//新增下面内容
es soft nofile 65536
es hard nofile 65546
es soft nproc 4096
es hard nproc 4096


1.2
vi /etc/sysctl.conf
vm.max_map_count=262144


修改完执行下面生效

sysctl -p

2.准备阶段
apache-skywalking-apm-7.0.0.tar.gz
elasticsearch-6.2.2.tar.gz

启动elasticsearch-6.2.2(简单,无需过多配置)

修改skywalking配置
修改webapp/webapp.yml 端口改个 skywalking web页面的端口


修改agent中config/agent.config

修改agent.service_name=${SW_AGENT_NAME:skywalking_boot}

skywalking_boot 自己取个名字(好像没啥用)

修改apache-skywalking-apm-bin目录下的 /config/application.yml


storage:
  selector: ${SW_STORAGE:elasticsearch}
  elasticsearch:
    nameSpace: ${SW_NAMESPACE:""}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9200}
    protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
    trustStorePath: ${SW_SW_STORAGE_ES_SSL_JKS_PATH:"../es_keystore.jks"}
    trustStorePass: ${SW_SW_STORAGE_ES_SSL_JKS_PASS:""}
    user: ${SW_ES_USER:""}
    password: ${SW_ES_PASSWORD:""}
    secretsManagementFile: ${SW_ES_SECRETS_MANAGEMENT_FILE:""} # Secrets management file in the properties format includes the username, password, which are managed by 3rd party tool.
    enablePackedDownsampling: ${SW_STORAGE_ENABLE_PACKED_DOWNSAMPLING:true} # Hour and Day metrics will be merged into minute index.
    dayStep: ${SW_STORAGE_DAY_STEP:1} # Represent the number of days in the one minute/hour/day index.
    indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2}
    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0}
    # Those data TTL settings will override the same settings in core module.
    recordDataTTL: ${SW_STORAGE_ES_RECORD_DATA_TTL:7} # Unit is day
    otherMetricsDataTTL: ${SW_STORAGE_ES_OTHER_METRIC_DATA_TTL:45} # Unit is day
    monthMetricsDataTTL: ${SW_STORAGE_ES_MONTH_METRIC_DATA_TTL:18} # Unit is month
    # 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: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
    resultWindowMaxSize: ${SW_STORAGE_ES_QUERY_MAX_WINDOW_SIZE:10000}
    metadataQueryMaxSize: ${SW_STORAGE_ES_QUERY_MAX_SIZE:5000}
    segmentQueryMaxSize: ${SW_STORAGE_ES_QUERY_SEGMENT_SIZE:200}
    profileTaskQueryMaxSize: ${SW_STORAGE_ES_QUERY_PROFILE_TASK_SIZE:200}
默认:selector :${SW_STORAGE:h2}   
修改成 selector :${SW_STORAGE:elasticsearch}   

最后把项目打成jar包 上传到linux
然后通过命令

java -javaagent:/usr/local/skywalking/apache-skywalking-apm-bin/agent/skywalking-agent.jar -jardistributed-security-eureka.jar &

让skywalking 探针获取项目的数据

大功告成 我慢慢再完善下

相关文章

网友评论

      本文标题:分布式skywalking链路追踪详细教程

      本文链接:https://www.haomeiwen.com/subject/xqmhektx.html