版本:
skywalking:8.3.0
es:6.8.2
1 安装
docker-compose.yml配置文件
配置文件
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: '3.5'
services:
elasticsearch:
image: elasticsearch:6.8.2
container_name: elasticsearch
restart: always
ports:
- 9200:9200
- 9300:9300
environment:
discovery.type: single-node
TZ: Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: apache/skywalking-oap-server:8.3.0-es6
container_name: oap
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
- 1234:1234
environment:
SW_STORAGE: elasticsearch
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
SW_HEALTH_CHECKER: default
SW_TELEMETRY: prometheus
TZ: Asia/Shanghai
healthcheck:
test: ["CMD", "./bin/swctl", "ch"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
ui:
image: apache/skywalking-ui:8.3.0
container_name: ui
depends_on:
- oap
links:
- oap
restart: always
ports:
- 8080:8080
environment:
SW_OAP_ADDRESS: oap:12800
TZ: Asia/Shanghai
安装 docker-compose
输入命令 docker-compose up
即可
2 项目整合
2.1 下载探针包
https://skywalking.apache.org/downloads/
2.2 下载对应版本,直接解压缩出来,找到
解压目录\apache-skywalking-apm-bin\agent\config\agent.config
2.3 修改配置文件:
agent.service_name=${SW_AGENT_NAME:ea-api}
collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:127.0.0.1:11800}
第一个是项目名称
第二个是skywalikng的grpc服务路径
2.4 拷贝agent目录到springboot项目根目录
3 springboot
3.1 dockerFile编写
FROM java:8
ADD target/*.jar root.jar
ADD agent/ /agent/
VOLUME /tmp
EXPOSE 8588
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
ENTRYPOINT ["java", "-javaagent:/agent/skywalking-agent.jar", "-jar","root.jar"]
然后docker build一下 在run起来 就完事了