SkyWalking部署及使用
# 启动SkyWalking启动台
README
## 修改es所需配置
vi /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p
## 启动顺序
1. elasticsearch 启动后关闭,赋权文件夹 [chmod -R 777 elasticsearch/*] 然后重启
2. skywalking-oap-server
3. skywalking-ui
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# docker-compose
docker-compose.yml
version: '3.3'
services:
elasticsearch:
image: elasticsearch:6.8.6
container_name: elasticsearch
environment:
- "cluster.name=elasticsearch" #设置集群名称为elasticsearch
- "discovery.type=single-node" #以单一节点模式启动
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
volumes:
- ./elasticsearch/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
- ./elasticsearch/data:/usr/share/elasticsearch/data #数据文件挂载
ports:
- 10800:9200
skywalking-oap-server:
image: apache/skywalking-oap-server:9.0.0
container_name: skywalking-oap-server
depends_on:
- elasticsearch
links:
- elasticsearch
restart: always
ports:
- 11800:11800
- 12800:12800
environment:
SW_STORAGE: elasticsearch # 指定ES版本
SW_STORAGE_ES_CLUSTER_NODES: elasticsearch:9200
TZ: Asia/Shanghai
# volumes:
# - ./oap/conf/alarm-settings.yml:/skywalking/config/alarm-settings.yml
skywalking-ui:
image: apache/skywalking-ui:9.0.0
container_name: skywalking-ui
depends_on:
- skywalking-oap-server
links:
- skywalking-oap-server
restart: always
ports:
- 13800:8080
environment:
SW_OAP_ADDRESS: http://skywalking-oap-server:12800
TZ: Asia/Shanghai
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
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
# 微服务镜像集成代理
# README
#SkyWalking 链路追踪版本
##准备
1. 把构建好的jar复制到files/jars目录下
2. 下载sentinel-dashboard-1.8.4.jar包复制到files/jars目录下
改名sentinel-dashboard.jar
[https://github.com/alibaba/Sentinel/releases]
3. 下载代理Java Agent[apache-skywalking-java-agent-8.10.0.tgz],放到files目录下,与Dockerfile同级
改名apache-skywalking-java-agent.tgz
[http://skywalking.apache.org/downloads]
[https://www.apache.org/dyn/closer.cgi/skywalking/java-agent/8.10.0/apache-skywalking-java-agent-8.10.0.tgz]
##启动
docker-compose up -d
##只构建镜像
docker-compose build
##区别
1. 使用代理
2. 启动前需指定收集器服务的地址
-Dskywalking.collector.backend_service=192.168.213.201:11800
## 使用本地IDEA启动
配置vm参数:
```
-javaagent:E:\Code\package\skywalking\skywalking-agent\skywalking-agent.jar
-Dskywalking.agent.service_name=ok-auth
-Dskywalking.collector.backend_service=192.168.213.201:11800
```
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
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
# Dockerfile模版示例
FROM openjdk:8-jre
RUN sh -c 'touch /app.jar'
COPY jars/ok-system-pure-auth.jar app.jar
COPY apache-skywalking-java-agent.tgz /apache-skywalking-java-agent.tgz
RUN tar zxvf apache-skywalking-java-agent.tgz
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -javaagent:/skywalking-agent/skywalking-agent.jar -Dskywalking.agent.service_name=pure-auth -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
1
2
3
4
5
6
2
3
4
5
6
# docker-compose.yml
version: '3'
services:
auth:
build:
context: ./files
dockerfile: AuthDockerfile
image: auth:1.5.0
container_name: auth
network_mode: bridge
ports:
- "9200:9200"
restart: always
environment:
- JAVA_OPTS=-Duser.timezone=GMT+08 -Dskywalking.collector.backend_service=192.168.213.201:11800
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
上次更新: 2023/03/13, 06:19:46