SkyWalking部署
SkyWalking部署

SkyWalking部署

skywalking介绍

  Skywalking是由国内开源爱好者吴晟开源并提交到Apache孵化器的开源项目, 2017年12月SkyWalking成为Apache国内首个个人孵化项目, 2019年4月17日SkyWalking从Apache基金会的孵化器毕业成为顶级项目, 目前SkyWalking支持Java、 .Net、 Node.js、 go、 python等探针, 数据存储支持MySQL、 ElasticSearch等, SkyWalking与Pinpoint相同, 对业务代码无侵入, 不过探针采集数据粒度相较于Pinpoint来说略粗, 但性能表现优秀, 目前SkyWalking增长势头强劲, 社区活跃, 中文文档齐全, 没有语言障碍, 支持多语言探针, 这些都是 SkyWalking的优势所在, 还有就是SkyWalking支持很多框架, 包括很多国产框架, 例如, Dubbo、 gRPC、 SOFARPC 等等, 同时也有很多开发者正在不断向社区提供更多插件以支持更多组件无缝接入SkyWalking。

官网地址:https://skywalking.apache.org/

skywalking特点简介

  • 实现从请求跟踪、 指标收集和日志记录的完整信息记录。
  • 多语言自动探针, 支持Java、 GO、 Python、 PHP、 NodeJS、 LUA、 Rust等客户端。
  • 内置服务网格可观察性, 支持从Istio+Envoy Service Mesh收集和分析数据。
  • 模块化架构, 存储、 集群管理、 使用插件集合都可以进行自由选择。
  • 支持告警。
  • 优秀的可视化效果。

skywalking与其他特性对比

skywalking组件逻辑架构

  • OAP平台(Observability Analysis Platform, 可观测性分析平台)或OAP Server, 它是一个高度组件化的轻量级分析程序, 由兼容各种探针Receiver、 流式分析内核和查询内核三部分构成。
  • 探针: 基于无侵入式的收集, 并通过HTTP或者gRPC方式发送数据到OAP Server。
  • 存储实现(Storage Implementors), SkyWalking OAP Server支持多种存储实现并且提供了标准接口, 可支持不同的存储后端。
  • UI模块(SkyWalking), 通过标准的GraphQL(Facebook在2012年开源)协议进行统计数据查询和展示 。

skywalking数据查询协议

  • 元数据查询: 查询在SkyWalking注册的服务、 服务实例、 Endpoint等元数据信息。
  • 拓扑关系查询: 查询全局、 或者单个服务、 Endpoint的拓扑图及依赖关系。
  • Metrics指标查询: 查询指标数据。
  • 聚合指标查询: 区间范围均值查询及Top N排名数据查询等。
  • Trace查询: 追踪数据的明细查询。
  • 告警查询: 基于表达式, 判断指标数据是否超出阈值。

skywalking优点

架构图

部署ES

可参考ES章节,此处部署的是单节点ES

部署Sky Walking

#官网下载安装包,

mkdir /apps/
mv ./apache-skywalking-apm-es7-8.6.0.tar.gz /apps
cd /apps/
unzip apache-skywalking-apm-es7-8.6.0.tar.gz

cd /apps/apache-skywalking-apm-bin-es7/
#展示目录结构,8.6.0的包里自带agent,后续的其他版本需要自行下载agent包
ll
total 104
drwxrwxr-x  9 ansible 1002   176 Jun  7  2021 agent
drwxr-xr-x  2 root    root   241 Aug  7 17:48 bin
drwxr-xr-x 11 root    root  4096 Oct 25 16:10 config
drwxr-xr-x  2 root    root    68 Aug  7 17:48 config-examples
-rwxrwxr-x  1 ansible 1002 31538 Jun  7  2021 LICENSE
drwxrwxr-x  3 ansible 1002  4096 Aug  7 17:48 licenses
drwxr-xr-x  2 root    root  8192 Oct 29 00:09 logs
-rwxrwxr-x  1 ansible 1002 32141 Jun  7  2021 NOTICE
drwxrwxr-x  2 ansible 1002 12288 Jun  7  2021 oap-libs
-rw-rw-r--  1 ansible 1002  1951 Jun  7  2021 README.txt
drwxr-xr-x  3 root    root    30 Aug  7 17:48 tools
drwxr-xr-x  2 root    root    53 Aug  7 17:48 webapp

配置文件修改

cd config
pwd
/apps/apache-skywalking-apm-bin-es7/config
ll
total 68
-rw-rw-r-- 1 ansible 1002  3298 Jun  7  2021 alarm-settings.yml
-rwxrwxr-x 1 ansible 1002 28622 Oct 24 13:07 application.yml
-rwxrwxr-x 1 ansible 1002  9924 Jun  7  2021 component-libraries.yml
-rw-rw-r-- 1 ansible 1002  1437 Jun  7  2021 endpoint-name-grouping.yml
drwxr-xr-x 2 root    root    24 Aug  7 17:48 envoy-metrics-rules
drwxr-xr-x 2 root    root    23 Aug  7 17:48 fetcher-prom-rules
-rwxrwxr-x 1 ansible 1002   963 Jun  7  2021 gateways.yml
drwxr-xr-x 2 root    root    48 Aug  7 17:48 lal
-rw-rw-r-- 1 ansible 1002  1812 Jun  7  2021 log4j2.xml
drwxr-xr-x 2 root    root    30 Aug  7 17:48 log-mal-rules
-rw-rw-r-- 1 ansible 1002   911 Jun  7  2021 metadata-service-mapping.yaml
drwxr-xr-x 2 root    root    32 Aug  7 17:48 meter-analyzer-config
drwxr-xr-x 2 root    root   121 Aug  7 17:48 oal
drwxr-xr-x 2 root    root   137 Aug  7 17:48 otel-oc-rules
-rw-rw-r-- 1 ansible 1002   958 Jun  7  2021 service-apdex-threshold.yml
drwxr-xr-x 2 root    root  4096 Aug  7 17:48 ui-initialized-templates
drwxr-xr-x 2 root    root    24 Aug  7 17:48 zabbix-rules


vim application.yml
cluster:
  selector: ${SW_CLUSTER:standalone}        
  standalone: #单节点模式
...
storage:
  selector: ${SW_STORAGE:elasticsearch7}
...
  elasticsearch7:
    nameSpace: ${SW_NAMESPACE:""}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:10.118.13.82:9200}  #ES地址
    protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"http"}
    trustStorePath: ${SW_STORAGE_ES_SSL_JKS_PATH:""}
    trustStorePass: ${SW_STORAGE_ES_SSL_JKS_PASS:""}
    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:1} # Shard number of new indexes
    indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:1} # Replicas number of new indexes
    # Super data set has been defined in the codes, such as trace segments.The following 3 config would be improve es performance when storage super size data in es.
    superDatasetDayStep: ${SW_SUPERDATASET_STORAGE_DAY_STEP:-1} # Represent the number of days in the super size dataset record index, the default value is the same as dayStep when the value is less than 0
    superDatasetIndexShardsFactor: ${SW_STORAGE_ES_SUPER_DATASET_INDEX_SHARDS_FACTOR:5} #  This factor provides more shards for the super data set, shards number = indexShardsNumber * superDatasetIndexShardsFactor. Also, this factor effects Zipkin and Jaeger traces.
    superDatasetIndexReplicasNumber: ${SW_STORAGE_ES_SUPER_DATASET_INDEX_REPLICAS_NUMBER:0} # Represent the replicas number in the super size dataset record index, the default value is 0.
    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.
    bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:1000} # Execute the async bulk record data every ${SW_STORAGE_ES_BULK_ACTIONS} 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}
    oapAnalyzer: ${SW_STORAGE_ES_OAP_ANALYZER:"{\"analyzer\":{\"oap_analyzer\":{\"type\":\"stop\"}}}"} # the oap analyzer.
    oapLogAnalyzer: ${SW_STORAGE_ES_OAP_LOG_ANALYZER:"{\"analyzer\":{\"oap_log_analyzer\":{\"type\":\"standard\"}}}"} # the oap log analyzer. It could be customized by the ES analyzer configuration to support more language log formats, such as Chinese log, Japanese log and etc.
    advanced: ${SW_STORAGE_ES_ADVANCED:""}
...
...

web端配置文件


cd ../webapp/
/apps/apache-skywalking-apm-bin-es7/webapp
ll
total 36016
-rw-r--r-- 1 ansible 1002 36874437 Jun  7  2021 skywalking-webapp.jar
-rw-r--r-- 1 ansible 1002      963 Jun  7  2021 webapp.yml

cat webapp.yml
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

server:
  port: 8080

collector:
  path: /graphql
  ribbon:
    ReadTimeout: 10000
    # Point to all backend's restHost:restPort, split by ,
    listOfServers: 127.0.0.1:12800

部署Sky Walking-agent(java单体应用,微服务)

部署Sky Walking-agent(Nginx编译部署)

实现日志采集功能

应用