skywalking部署

系统设置

软件清单

系统:ubuntu20.04

skywalking-apm: 9.1.0

openjdk:17.0.3

es: 8.3.3

系统要求

CPU Memory
4 core 4 GB RAM

端口列表

Name Port Destination
skywalking-ui 8080 前端服务
skywalking-oap 11800/12800 可观测分析平台。11800为数据写入端口,12800为查询端口
es 9200 es数据读写端口
agent   skywalking agent,用于收集app中的访问请求

安装oepnjdk

# apt -y install openjdk-17-jdk

部署Elasticsearch

安装elasticearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.3-amd64.deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.3-amd64.deb.sha512
shasum -a 512 -c elasticsearch-8.3.3-amd64.deb.sha512 
sudo dpkg -i elasticsearch-8.3.3-amd64.deb

配置elasticearch

cluster.name: skywalking-es-cluster
node.name: es-01
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
network.host: 192.168.174.102
http.port: 9200
discovery.seed_hosts: ["192.168.174.102"]
cluster.initial_master_nodes: ["192.168.174.102"]
....
cluster.initial_master_nodes: ["es-01"]
http.host: 0.0.0.0

访问elasticearch

~# curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200
Enter host password for user 'elastic':
{
  "name" : "es-01",
  "cluster_name" : "skywalkinges-cluster",
  "cluster_uuid" : "A2t_ew5lQTijn5q_ovrxCA",
  "version" : {
    "number" : "8.3.3",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "801fed82df74dbe537f89b71b098ccaff88d2c56",
    "build_date" : "2022-07-23T19:30:09.227964828Z",
    "build_snapshot" : false,
    "lucene_version" : "9.2.0",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

查看http.p12密码

查看代码
 ~# /usr/share/elasticsearch/bin/elasticsearch-keystore show xpack.security.http.ssl.keystore.secure_password
_mHaIUe_SiOMLoLVxSX6_Q

查看transport.p12密码

~# /usr/share/elasticsearch/bin/elasticsearch-keystore show xpack.security.transport.ssl.keystore.secure_password
EhPpxFSLSF-cyr-WqkTYyg

部署skywalking

https://skywalking.apache.org/docs/main/latest/readme/

下载skywalking安装包

# version=9.1.0
# wget https://dlcdn.apache.org/skywalking/9.1.0/apache-skywalking-apm-${version}.tar.gz
# tar xf apache-skywalking-apm-${version}.tar.gz -C /usr/local

配置skywalking

~# vim /usr/local/apache-skywalking-apm-bin/config/application.yml
...
storage:
  selector: ${SW_STORAGE:elasticsearch}
  elasticsearch:
    namespace: ${SW_NAMESPACE:"skywalking-index"}
    clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9200}
    protocol: ${SW_STORAGE_ES_HTTP_PROTOCOL:"https"}
    connectTimeout: ${SW_STORAGE_ES_CONNECT_TIMEOUT:3000}
    socketTimeout: ${SW_STORAGE_ES_SOCKET_TIMEOUT:30000}
    responseTimeout: ${SW_STORAGE_ES_RESPONSE_TIMEOUT:15000}
    numHttpClientThread: ${SW_STORAGE_ES_NUM_HTTP_CLIENT_THREAD:0}
    user: ${SW_ES_USER:"elastic"}
    password: ${SW_ES_PASSWORD:"AClTW*BbjufV39H5tUQS"}
    trustStorePath: ${SW_STORAGE_ES_SSL_JKS_PATH:"/etc/elasticsearch/certs/http.p12"}
    trustStorePass: ${SW_STORAGE_ES_SSL_JKS_PASS:"_mHaIUe_SiOMLoLVxSX6_Q"}

...

运行skywalking

查看代码
 ~# /usr/local/apache-skywalking-apm-bin/bin/startup.sh 
SkyWalking OAP started successfully!
SkyWalking Web Application started successfully!

查看UI

查看es数据

docker-compose部署skywalking

安装依赖

安装docker,docker-compose

创建es数据目录

~# mkdir -pv /data/apps/skywalking/es/data
~# docker run --rm elasticsearch:7.17.5 id elasticsearch
uid=1000(elasticsearch) gid=1000(elasticsearch) groups=1000(elasticsearch),0(root)
~# chwon -R 1000.1000 /data/apps/skywalking/es

准备docker-compose.yml

version: "3"

services:
  elasticsearch:
    image: elasticsearch:8.4.2
    container_name: elasticsearch
    ports:
      - "9200:9200"
    healthcheck:
      test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      discovery.type: single-node
      ingest.geoip.downloader.enabled: "false"
      bootstrap.memory_lock: true
      ES_JAVA_OPTS: "-Xms512m -Xmx512m"
      TZ: "Asia/Shanghai"
      xpack.security.enabled: "false"
    ulimits:
      memlock:
        soft: -1
        hard: -1

  skywalking-oap:
    image: apache/skywalking-oap-server:9.1.0
    container_name: skywalking-oap
    depends_on:
      elasticsearch:
        condition: service_healthy
    links:
      - elasticsearch
    environment:
      SW_HEALTH_CHECKER: default
      SW_STORAGE: elasticsearch
      SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
      JAVA_OPTS: "-Xms2048m -Xmx2048m"
      TZ: Asia/Shanghai
      SW_TELEMETRY: prometheus
    healthcheck:
      test: ["CMD-SHELL", "/skywalking/bin/swctl ch"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    restart: on-failure
    ports:
      - "11800:11800"
      - "12800:12800"

  skywalking-ui:
    image: apache/skywalking-ui:9.1.0
    depends_on:
      skywalking-oap:
        condition: service_healthy
    links:
      - skywalking-oap
    ports:
    - "8080:8080"
    environment:
      SW_OAP_ADDRESS: http://skywalking-oap:12800
      SW_HEALTH_CHECKER: default
      TZ: Asia/Shanghai

访问es

~# curl http://localhost:9200
{
  "name" : "99be81ba8249",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "vdpKJB8iRwykH3GtfPD52A",
  "version" : {
    "number" : "7.17.5",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "8d61b4f7ddf931f219e3745f295ed2bbc50c8e84",
    "build_date" : "2022-06-23T21:57:28.736740635Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 

posted @ 2022-08-08 18:12  小吉猫  阅读(1560)  评论(1编辑  收藏  举报