docker-compose方式安装skywalking (分布式)
服务端安装docker-compose文件```yamlversion: '3.3'services:elasticsearch:image: elasticsearch:7.9.0container_name: elasticsearchrestart: alwaysports:- 9200:9200environment:discovery.type: single-nodeTZ: Asia/
服务端安装
docker-compose文件
```yaml
version: '3.3'
services:
elasticsearch:
image: elasticsearch:7.9.0
container_name: elasticsearch
restart: always
ports:
- 9200:9200
environment:
discovery.type: single-node
TZ: Asia/Shanghai
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: apache/skywalking-oap-server:8.1.0-es7
container_name: oap
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
environment:
SW_STORAGE: elasticsearch7 # 指定ES版本
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
TZ: Asia/Shanghai
ui:
image: apache/skywalking-ui:8.1.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 up -d
查看启动
docker-compose ps
在window系统中使用google浏览器访问skywalking-ui界面
elasticsearch启动时间比较长,需要耐心等待几分钟
http://192.168.198.141:8080/
客户端安装
下载源码
http://archive.apache.org/dist/skywalking/8.1.0/
上传到客户端的服务器
cd /opt
tar zxf apache-skywalking-apm-8.1.0.tar.gz
rm -rf apache-skywalking-apm-8.1.0.tar.gz
Java Agent配置方式
java -javaagent:/opt/skywalking/apache-skywalking-apm-bin/agent/skywalking-agent.jar -Dskywalking.agent.service_name=skywalkingdemo3 -Dskywalking.collector.backend_service=192.168.1.11:11800 -jar SkywalkingDemo-0.0.1-SNAPSHOT.jar
skywalking集成docker
准备工作
新建自定义镜像目录 mkdir -p /data/skywalking
将SkywalkingDemo-0.0.1-SNAPSHOT.jar复制到/data/skywalking目录中 cp
/data/SkywalkingDemo-0.0.1-SNAPSHOT.jar /data/skywalking/
配置agent
将agent目录复制到/data/skywalking备用 cp -r
/opt/skywalking/apache-skywalking-apm-bin/agent /data/skywalking
Dockerfile
FROM openjdk:8-alpine3.9
# 作者信息
MAINTAINER laosiji Docker skywalking springboot "laosiji@yyjzy.com"
#修改镜像为东八区时间 ENV TZ Asia/Shanghai
COPY agent/ /opt/skyagent/
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
EXPOSE 8081
ENV JAVA_OPTS="-server -Xmx256m -Xms256m" AGENT_SERVICE_NAME="default" AGENT_COLLECTOR_ADDRESS="192.168.1.11:11800"
ENTRYPOINT java -javaagent:/opt/skyagent/skywalking-agent.jar=agent.service_name=${AGENT_SERVICE_NAME},collector.backend_service=${AGENT_COLLECTOR_ADDRESS} ${JAVA_OPTS} -jar /app.jar
制作镜像
cd /data/skywalking docker build -t yyjzy/skywalkingdemo1:1.0
–build-arg JAR_FILE=SkywalkingDemo-0.0.1-SNAPSHOT.jar
运行镜像
docker run -d -p 8081:8081 --name skydemo1 yyjzy/skywalkingdemo1:1.0
更多推荐
所有评论(0)