1. skywalking
官網(wǎng):https://skywalking.apache.org/
特點(diǎn):
1.SkyWalking: 一個(gè)開源的可觀測平臺(tái), 用于從服務(wù)和云原生基礎(chǔ)設(shè)施收集, 分析, 聚合及可視化數(shù)據(jù)。
2.SkyWalking 更是一個(gè)現(xiàn)代化的應(yīng)用程序性能監(jiān)控(Application Performance Monitoring)系統(tǒng), 尤其專為云原生、基于容器的分布式系統(tǒng)設(shè)計(jì).
2.架構(gòu)
skywalking.png
2.1 架構(gòu)組件簡介
1. 上部分Agent: 負(fù)責(zé)從應(yīng)用中,收集鏈路信息,發(fā)給Skywalking oap 服務(wù)器.
2. 下部分Skywalking oap: 負(fù)責(zé)接收到Agent 發(fā)送的Tracing 的數(shù)據(jù)信息,然后進(jìn)行分析(Analysis platform) ,存儲(chǔ)到外部存儲(chǔ)器最終提供query 查詢功能.
3.左邊Storage: Tracing數(shù)據(jù)存儲(chǔ)碘饼,目前支持ES烁峭、MySQL、Sharding Sphere郊尝、TiDB二跋、H2多種存儲(chǔ)器,目前采用較多的是ES流昏,主要考慮是SkyWalking開發(fā)團(tuán)隊(duì)自己的生產(chǎn)環(huán)境采用ES為主.
4.右邊UI:負(fù)責(zé)提供控制臺(tái)扎即,查看鏈路等等吞获;
2.2 目錄簡介
在這里插入圖片描述
3. 啟動(dòng)skywalking 默認(rèn)的配置服務(wù)
[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 有時(shí)候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. 找一個(gè)spring boot 項(xiàng)目 運(yùn)行
命令:
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 項(xiàng)目
在這里插入圖片描述
6. 然后看Syywalking
在這里插入圖片描述
在這里插入圖片描述
7. 或者寫一個(gè)腳本
[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數(shù)量谚鄙,默認(rèn)為 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啟動(dòng)
7.1 運(yùn)行 : 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)