K8shbase

skywalking 架构部署

2021-09-08  本文已影响0人  sknfie

概述

Skywalking是一个可观测性分析平台(Observability Analysis Platform简称OAP)和应用性能管理系统(Application Performance Management简称APM)。
提供分布式链路追踪、服务网格(Service Mesh)遥测分析、度量(Metric)聚合和可视化一体化解决方案。

架构

架构

Skywalking提供Tracing和Metrics数据的获取和聚合:

部署

接下来我们在虚拟机CentOS中搭建Skywalking的可观测性分析平台OAP环境。Skywalking默认使用H2内存中进行数据的存储,我们可以替换存储源为ElasticSearch保证其查询的高效及可用性。
具体的安装步骤可以在Skywalking的官方github上找到:

https://github.com/apache/skywalking/blob/master/docs/en/setup/README.md

1、创建目录

mkdir /usr/local/skywalking

建议将虚拟机内存设置为8G并且将CPU设置成4核,防止资源不足。

2、将资源目录中的elasticsearch和skywalking安装包上传到虚拟机/usr/local/skywalking目录下。

3、首先安装elasticsearch,将压缩包解压。

修改Linux系统的限制配置,将文件创建数修改为65536个。

vi /etc/security/limits.conf 
#新增如下内容在limits.conf文件中 
es soft nofile 65536 
es hard nofile 65536 
es soft nproc 4096 
es hard nproc 4096

vi /etc/sysctl.conf 
#新增如下内容在sysctl.conf文件中,当前用户拥有的内存权限大小 vm.max_map_count=262144 
#让系统控制权限配置生效 sysctl -p

建一个用户, 用于ElasticSearch启动。

ES在5.x版本之后,强制要求在linux中不能使用root用户启动ES进程。所以必须使用其他用户启动ES进程才可以。

#创建用户 useradd es 
#修改上述用户的密码 
passwd es 
#修改elasicsearch目录的拥有者 
chown -R es elasticsearch-6.4.0

使用es用户启动elasticsearch

#切换用户 
su es 
#到ElasticSearch的bin目录下 
cd bin/ 
#后台启动 
./elasticsearch -d

默认ElasticSearch是不支持跨域访问的,所以在不修改配置文件的情况下我们只能从虚拟机内部进行访问测试ElasticSearch是否安装成功,使用curl命令访问9200端口:

curl http://localhost:9200

#如果显示出如下信息,就证明ElasticSearch安装成功:
{
  "name" : "JQP4lam",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "chZRaiKjSLyvs9vHs4Yq4g",
  "version" : {
    "number" : "6.4.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "595516e",
    "build_date" : "2018-08-17T23:18:47.308994Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

4、安装Skywalking,分为两个步骤:

tar -zxvf apache-skywalking-apm-6.4.0.tar.gz

修改Skywalking存储的数据源配置:

cd apache-skywalking-apm-bin 
vi config/application.yml

storage:
  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:""}
    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}
#  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}
#    metadataQueryMaxSize: ${SW_STORAGE_H2_QUERY_MAX_SIZE:5000}

启动skywalking的前后端:

bin/startup.sh
SkyWalking OAP started successfully!
SkyWalking Web Application started successfully!
skywalking ui
上一篇下一篇

猜你喜欢

热点阅读