一、下载镜像

#注意 skywalking-oap-server和skywalking java agent版本强关联,版本需要保持一致性
docker pull elasticsearch:7.9.0
docker pull apache/skywalking-oap-server:8.1.0-es7
docker pull apache/skywalking-ui:8.1.0

二、部署文件docker-compose.yaml

注意:权限chmod 777 /data/elasticsearch/data

version: '3'
services:
  es7:
    image: elasticsearch:7.9.0
    container_name: es7
    environment:
      - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
      - "discovery.type=single-node" #以单一节点模式启动
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m" #设置使用jvm内存大小
    volumes:
      - /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
      - /data/elasticsearch/data:/usr/share/elasticsearch/data #数据文件挂载
    ports:
      - 9200:9200
      - 9300:9300

  oap:
    image: apache/skywalking-oap-server:8.1.0-es7
    container_name: oap
    depends_on: 
      - es7
    links:
      - es7
    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: elasticsearch7
      SW_STORAGE_ES_CLUSTER_NODES: es7:9200
      SW_HEALTH_CHECKER: default
      TZ: Asia/Shanghai
      SW_TELEMETRY: prometheus
      JAVA_OPTS: "-Xms2048m -Xmx2048m"

  ui:
    image: apache/skywalking-ui:8.1.0
    container_name: ui
    depends_on: 
      - oap
    links:
      - oap
    ports:
      - "8088:8080"  #为了防止8080端口冲突 这里用8088端口映射
    environment:
      SW_OAP_ADDRESS: http://oap:12800
      TZ: Asia/Shanghai

三、java agent部署

下载apache-skywalking-apm-8.1.0.tar.gz解压
启动应用

#注意需要整个java agent目录
java -javaagent:/apache-skywalking-apm-bin/agent/skywalking-agent.jar \
-Dskywalking.agent.service_name=xxxtest \
-Dskywalking.collector.backend_service=127.0.0.1:11800 \
-jar spring-boot-demo-0.0.1-SNAPSHOT.jar
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐