资源地址:
github地址:GitHub - apache/skywalking: APM, Application Performance Monitoring System
java agent下载地址:Index of /dist/skywalking/java-agent
一.监控架构图
二.使用docker-compose启动skywalking以及ES
version: '3.3'
services:
es8:
image: elasticsearch:8.4.2
container_name: es8
ports:
- 9200:9200
- 9300:9300
environment:
xpack.security.enabled: "false"
discovery.type: "single-node" #单例模式
ingest.geoip.downloader.enabled: "false"
#锁定物理内存地址,防止es内存被交换出去,也就是避免es使用swap交换分区,频繁的交换,会导致IOPS变高
bootstrap.memory_lock: "true"
ES_JAVA_OPTS: "-Xms6g -Xmx6g" #堆内存大小
TZ: Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /home/data/skywalking/elasticsearch/data:/usr/share/elasticsearch/data
skywalking-oap:
image: apache/skywalking-oap-server:9.4.0
container_name: skywalking-oap
restart: always
depends_on:
- es8
links:
- es8
ports:
- 11800:11800
- 12800:12800
environment:
SW_CORE_RECORD_DATA_TTL: 7 #记录数据的���效期,单位天
SW_CORE_METRICS_DATA_TTL: 7 #分析指标数据的有效期,单位天
SW_ENABLE_UPDATE_UI_TEMPLATE: "true" # 开启dashboard编辑修改功能
SW_HEALTH_CHECKER: default
TZ: Asia/Shanghai
SW_STORAGE: elasticsearch
JAVA_OPTS: "-Xms2048m -Xmx2048m"
#SW_STORAGE: elasticsearch7
SW_STORAGE_ES_CLUSTER_NODES: es8:9200
#volumes:
#- ./config:/skywalking/config
skywalking-ui:
image: apache/skywalking-ui:9.4.0
#image: apache/skywalking-ui:9.0.0
container_name: skywalking-ui
restart: always
depends_on:
- skywalking-oap
links:
- skywalking-oap
ports:
- 18080:8080
environment:
TZ: Asia/Shanghai
SW_HEALTH_CHECKER: default
SW_OAP_ADDRESS: http://skywalking-oap:12800
三.部署java agent,运行
nohup /usr/local/jdk-11/bin/java -javaagent:/home/wwwroot/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=java-test -Dskywalking.collector.backend_service=192.168.10.16:11800 -jar java-test.jar --spring.config.local=application.yml &
注意事项:agent要加在应用包前面启动。