1. skywalking

官网:https://skywalking.apache.org/

特点:

1.SkyWalking: 一个开源的可观测平台, 用于从服务和云原生基础设施收集, 分析, 聚合及可视化数据。
2.SkyWalking 更是一个现代化的应用程序性能监控(Application Performance Monitoring)系统, 尤其专为云原生、基于容器的分布式系统设计.

2.架构

在这里插入图片描述

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 730 21:36 skywalking-webapp.jar
-rw-r--r-- 1 1001 1002     1346 730 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)

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐