1. skywalking
官網:https://skywalking.apache.org/
特點:
1.SkyWalking: 一個開源的可觀測平臺, 用于從服務和云原生基礎設施收集, 分析, 聚合及可視化數據。
2.SkyWalking 更是一個現代化的應用程序性能監控(Application Performance Monitoring)系統, 尤其專為云原生、基于容器的分布式系統設計.
2.架構
skywalking.png
2.1 架構組件簡介
1. 上部分Agent: 負責從應用中,收集鏈路信息,發給Skywalking oap 服務器.
2. 下部分Skywalking oap: 負責接收到Agent 發送的Tracing 的數據信息,然后進行分析(Analysis platform) ,存儲到外部存儲器最終提供query 查詢功能.
3.左邊Storage: Tracing數據存儲,目前支持ES、MySQL、Sharding Sphere、TiDB、H2多種存儲器,目前采用較多的是ES,主要考慮是SkyWalking開發團隊自己的生產環境采用ES為主.
4.右邊UI:負責提供控制臺,查看鏈路等等;
2.2 目錄簡介
在這里插入圖片描述
3. 啟動skywalking 默認的配置服務
[root@basenode bin]# ./startup.sh
SkyWalking OAP started successfully!
SkyWalking Web Application started successfully!
[root@basenode bin]# pwd
/opt/module/skywalking-apm-bin-es7/bin
[root@basenode bin]#
4. 頁面訪問地址
http://192.168.1.180:8080/
在這里插入圖片描述
4.1 有時候8080 的端口被占用后, 我們可以修改端口
直接修改8080 端口
[root@basenode webapp]# pwd
/opt/module/skywalking-apm-bin-es7/webapp
[root@basenode skywalking-apm-bin-es7]# cd webapp/
[root@basenode webapp]# ll
總用量 35360
-rw-r--r-- 1 1001 1002 36201156 7月 30 21:36 skywalking-webapp.jar
-rw-r--r-- 1 1001 1002 1346 7月 30 20:32 webapp.yml
[root@basenode webapp]# vi webapp.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.
server:
port: 8080
spring:
cloud:
gateway:
routes:
- id: oap-route
uri: lb://oap-service
predicates:
- Path=/graphql/**
5. 找一個spring boot 項目 運行
命令:
java -javaagent:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar -jar /opt/module/demo/user-center-0.0.1-SNAPSHOT.jar
5.1 然后訪問自己的spring boot 項目
在這里插入圖片描述
6. 然后看Syywalking
在這里插入圖片描述
在這里插入圖片描述
7. 或者寫一個腳本
[root@basenode demo]# vi startup.sh
#!/bin/sh
# SkyWalking Agent配置
export SW_AGENT_NAME=springboot-skywalking-wudl #Agent名字,一般使用`spring.application.name`
export SW_AGENT_COLLECTOR_BACKEND_SERVICES=192.168.1.180:11800 #配置 Collector 地址。
export SW_AGENT_SPAN_LIMIT=2000 #配置鏈路的最大Span數量,默認為 300。
export JAVA_AGENT=-javaagent:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar
java $JAVA_AGENT -jar /opt/module/demo/user-center-0.0.1-SNAPSHOT.jar #jar啟動
7.1 運行 : sh startup.sh
[root@basenode demo]# sh startup.sh
DEBUG 2021-09-12 18:01:30:050 main AgentPackagePath : The beacon class location is jar:file:/opt/module/skywalking-apm-bin-es7/agent/skywalking-agent.jar!/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.class.
INFO 2021-09-12 18:01:30:051 main SnifferConfigInitializer : Config file found in /opt/module/skywalking-apm-bin-es7/agent/config/agent.config.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.2.RELEASE)
2021-09-12 18:01:39.170 INFO 5590 --- [ main] c.wudl.usercenter.UserCenterApplication : Starting UserCenterApplication v0.0.1-SNAPSHOT on basenode with PID 5590 (/opt/module/demo/user-center-0.0.1-SNAPSHOT.jar started by root in /opt/module/demo)
2021-09-12 18:01:39.177 INFO 5590 --- [ main] c.wudl.usercenter.UserCenterApplication : The following profiles are active: dev
2021-09-12 18:01:43.948 INFO 5590 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9909 (http)
2021-09-12 18:01:44.050 INFO 5590 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-09-12 18:01:44.050 INFO 5590 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.29]
2021-09-12 18:01:44.196 INFO 5590 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-09-12 18:01:44.197 INFO 5590 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4819 ms
2021-09-12 18:01:47.260 INFO 5590 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-09-12 18:01:47.956 INFO 5590 --- [ main] t.m.m.autoconfigure.MapperCacheDisabler : Clear tk.mybatis.mapper.util.MsUtil CLASS_CACHE cache.
2021-09-12 18:01:47.956 INFO 5590 --- [ main] t.m.m.autoconfigure.MapperCacheDisabler : Clear tk.mybatis.mapper.genid.GenIdUtil CACHE cache.
2021-09-12 18:01:47.957 INFO 5590 --- [ main] t.m.m.autoconfigure.MapperCacheDisabler : Clear tk.mybatis.mapper.version.VersionUtil CACHE cache.
2021-09-12 18:01:47.957 INFO 5590 --- [ main] t.m.m.autoconfigure.MapperCacheDisabler : Clear EntityHelper entityTableMap cache.
2021-09-12 18:01:48.365 INFO 5590 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9909 (http) with context path ''
2021-09-12 18:01:48.370 INFO 5590 --- [ main] c.wudl.usercenter.UserCenterApplication : Started UserCenterApplication in 11.576 seconds (JVM running for 18.419)