skywalking在docker中应用
准备工作
- 下载源码包,下面会用到agent
1
https://archive.apache.org/dist/skywalking/6.6.0/apache-skywalking-apm-6.6.0.tar.gz
- 拉取镜像
1
2
3docker pull elasticsearch:7.5.1
docker pull apache/skywalking-oap-server:6.6.0-es7
docker pull apache/skywalking-ui:6.6.0安装elasticsearch
修改系统参数
1
2
3
4
5vi /etc/sysctl.conf
vm.max_map_count=262144 #调整参数
sysctl -p #刷新参数启动elasticsearch
1
2
3docker run -d --name=es7 \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" elasticsearch:7.5.1创建持久化目录 并拷贝数据
1
2
3
4mkdir -p /data/elasticsearch
docker cp es7:/usr/share/elasticsearch/data /data/elasticsearch/
docker cp es7:/usr/share/elasticsearch/logs /data/elasticsearch/
docker rm -f es7docker-compose编排部署es,skywalking
创建编排文件
1
2cd /data && touch docker-compose.yml
tar -zxvf apache-skywalking-apm-6.6.0.tar.gz #解压源码以便后续使用agent编辑编排文件
docker-compose up -d 直接启动即可1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52version: '3'
networks:
cq-data-security: ##我这里选择了已有网卡,与我java项目网卡一致可以容器之间相互通信,具体需求看自己
external: true
services:
es7:
image: elasticsearch:7.5.1
container_name: es7
expose:
- 9200
- 9300
restart: always
volumes:
- /data/elasticsearch/data:/usr/share/elasticsearch/data
- /data/elasticsearch/logs:/usr/share/elasticsearch/logs
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
- discovery.type=single-node
networks:
cq-data-security:
ipv4_address: 172.62.0.51
skywalking-oap-server:
image: apache/skywalking-oap-server:6.6.0-es7
container_name: skywalking-oap-server
expose:
- 12800
- 11800
privileged: true
restart: always
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
- SW_STORAGE=elasticsearch
- SW_STORAGE_ES_CLUSTER_NODES=172.62.0.51:9200
networks:
cq-data-security:
ipv4_address: 172.62.0.52
skywalking-ui:
image: apache/skywalking-ui:6.6.0
container_name: skywalking-ui
ports:
- 28080:8080
privileged: true
restart: always
environment:
- SW_OAP_ADDRESS=172.62.0.52:12800
networks:
cq-data-security:
ipv4_address: 172.62.0.53
访问localhost:28080 ui访问
agent部署
1 | cd /data |
1 | #编辑dockerfile将以下参数加入dockerfile |
#修改java应用启动参数
1 | java -javaagent:/root/agent/skywalking-agent.jar=agent.service_name=group_module -Dskywalking.collector.backend_service=172.62.0.52:11800 -jar /root/group-module-1.0-SNAPSHOT.jar --server.port=8890 |
至此客户端和服务端部署完成,可以打开ui界面进行访问
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Alexcld!
评论