2024-06-20
后端技术
0
请注意,本文编写于 142 天前,最后修改于 142 天前,其中某些信息可能已经过时。

目录

1、使用 Docker 安装 Elaticsearch
2、安装 Apache/SkyWalking-oap-server
3、下载Skywalking-ui
4、访问 localhost:8080 查看 Skywalking 管理界面
5、Net5 集成 SkyWalking
6、参考资料

hub.docker SkyAPM

1、使用 Docker 安装 Elaticsearch

ES_JAVA_OPTS="-Xms128m -Xmx512m" 用于解决内存太小的问题

csharp
docker pull elasticsearch:7.8.0 docker run -d --name=es7 -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms128m -Xmx512m" -e "discovery.type=single-node" elasticsearch:7.8.0

2、安装 Apache/SkyWalking-oap-server

csharp
docker pull apache/skywalking-oap-server:8.3.0-es7 docker run --name oap -d --restart=always -e TZ=Asia/Shanghai -p 12800:12800 -p 11800:11800 --link es7:es7 -e SW_STORAGE=elasticsearch7 -e SW_STORAGE_ES_CLUSTER_NODES=es7:9200 apache/skywalking-oap-server:8.3.0-es7

3、下载Skywalking-ui

csharp
docker pull apache/skywalking-ui:8.3.0 docker run -d --name skywalking-ui --restart=always -e TZ=Asia/Shanghai -p 8080:8080 --link oap:oap -e SW_OAP_ADDRESS=oap:12800 apache/skywalking-ui:8.3.0

image.png

4、访问 localhost:8080 查看 Skywalking 管理界面

image.png

5、Net5 集成 SkyWalking

借用上篇文章 Net5 使用Ocelot+Consul
GatewaysApp.Gateways中加入包 SkyAPM.Agent.AspNetCore,版本1.3.0,同时加入skyapm.json 文件,并设置属性为较新则复制
launchSettings.json 中添加环境变量

csharp
"SKYWALKING__SERVICENAME": "AppGateWay/ApiGateway", "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "SkyAPM.Agent.AspNetCore"

image.png

csharp
// Programs 文件 .ConfigureAppConfiguration(builder => { builder.AddJsonFile("ocelot.json", false, true) .AddJsonFile("skyapm.json", false, true); })
json
// Gateways { "SkyWalking": { "ServiceName": "ApiGateWay", "Namespace": "", "HeaderVersions": [ "sw8" ], "Sampling": { "SamplePer3Secs": -1, "Percentage": -1.0 }, "ServiceInstanceName": "ApiGateWay.001", "Logging": { "Level": "Information", "FilePath": "logs\\skyapm-{Date}.log" }, "Transport": { "Interval": 3000, "ProtocolVersion": "v8", "QueueSize": 30000, "BatchSize": 3000, "gRPC": { "Servers": "192.168.2.17:11800", "Timeout": 10000, "ConnectTimeout": 10000, "ReportTimeout": 600000, "Authentication": "" } } } } // App.Gateways { "SkyWalking": { "ServiceName": "AppGateWay", "Namespace": "", "HeaderVersions": [ "sw8" ], "Sampling": { "SamplePer3Secs": -1, "Percentage": -1.0 }, "ServiceInstanceName": "ApiGateWay.002", "Logging": { "Level": "Information", "FilePath": "logs\\skyapm-{Date}.log" }, "Transport": { "Interval": 3000, "ProtocolVersion": "v8", "QueueSize": 30000, "BatchSize": 3000, "gRPC": { "Servers": "192.168.2.17:11800", "Timeout": 10000, "ConnectTimeout": 10000, "ReportTimeout": 600000, "Authentication": "" } } } }

image.png

image.png

6、参考资料

https://www.cnblogs.com/jianghaidong/p/15693935.html

本文作者:一叶知秋

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!