Linux: 应用程序性能监控工具-SkyWalking
官方网站:https://skywalking.apache.org/
安装
docker-compose 安装 skywalking
docker-compose 安装
yum install docker-compose-plugin -y
创建 es 数据目录
mkdir /data/elasticsearch/{data,logs} 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/elasticsearch/
skywalking
创建启动文件
$ cat docker-compose.yaml version: '3.8' services: elasticsearch: image: elasticsearch:7.17.5 container_name: elasticsearch ports: - "9200:9200" healthcheck: test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1" ] interval: 30s timeout: 10s retries: 3 start_period: 10s environment: - discovery.type=single-node - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - TZ=Asia/Shanghai ulimits: memlock: soft: -1 hard: -1 volumes: - /data/elasticsearch/data:/usr/share/elasticsearch/data - /data/elasticsearch/logs:/usr/share/elasticsearch/logs oap: image: apache/skywalking-oap-server:9.1.0 container_name: oap depends_on: elasticsearch: condition: service_healthy links: - elasticsearch ports: - "11800:11800" - "12800:12800" healthcheck: test: [ "CMD-SHELL", "/skywalking/bin/swctl ch" ] interval: 30s timeout: 10s retries: 3 start_period: 10s environment: SW_STORAGE: elasticsearch SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200 SW_HEALTH_CHECKER: default SW_TELEMETRY: prometheus JAVA_OPTS: "-Xms2048m -Xmx2048m" TZ: Asia/Shanghai ui: image: apache/skywalking-ui:9.1.0 container_name: ui depends_on: oap: condition: service_healthy links: - oap ports: - "8080:8080" environment: SW_OAP_ADDRESS: http://oap:12800 TZ: Asia/Shanghai
启动 skywalking
docker compose up -d
nginx 配置
cat qa-skywalking.conf server { listen 80; listen 443 ssl http2; server_name qa-apm.xxx.com; ssl_certificate ssl/xxx.pem; ssl_certificate_key ssl/xxx.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5:!DH; if ( $scheme = 'http' ) { return 302 https://$server_name$request_uri; } location / { proxy_set_header Host $Host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto "https"; proxy_pass http://172.17.16.32:8080; } }
k8s 安装
添加 Helm 仓库
export REPO=skywalking helm repo add ${REPO} https://apache.jfrog.io/artifactory/skywalking-helm
配置变量
oap: image: tag: 8.7.0-es7 # Set the right tag according to the existing Elasticsearch version storageType: elasticsearch7 env: SW_NAMESPACE: "skywalking-prod" SW_STORAGE_ES_FLUSH_INTERVAL: 30 SW_STORAGE_ES_QUERY_MAX_SIZE: 10000 SW_STORAGE_ES_BULK_ACTIONS: 4000 # SW_STORAGE_ES_ADVANCED: '"{\"index.lifecycle.name\":\"skywalking-prod-policy\"}"' nodeSelector: eks.amazonaws.com/nodegroup: AGT-PFGC-EKS-NewRummy-SC resources: limits: cpu: 2 memory: 8Gi requests: cpu: 1 memory: 8Gi ui: image: tag: 8.7.0 elasticsearch: enabled: false config: # For users of an existing elasticsearch cluster,takes effect when `elasticsearch.enabled` is false host: PFGC-Devops-Internal-NLB-3f391eabefdedb68.elb.ap-south-1.amazonaws.com port: http: 9200
安装服务
helm --create-namespace skywalking -n skywalking install skywalking -f values-my-es2.yaml #更新服务 helm --create-namespace skywalking -n skywalking install skywalking -f values-my-es2.yaml