skywalking架构原理与安装部署
一、skywalking介绍
Skywalking是由国内开源爱好者吴晟开源并提交到Apache孵化器的开源项目, 2017年12月SkyWalking成为Apache国内首个个人孵化项目, 2019年4月17日SkyWalking从Apache基金会的孵化器毕业成为顶级项目, 目前SkyWalking支持Java、 .Net、 Node.js、 go、 python等探针, 数据存储支持MySQL、 ElasticSearch等, SkyWalking与Pinpoint相同, 对业务代码无侵入, 不过探针采集数据粒度相较于Pinpoint来说略粗, 但性能表现优秀, 目前SkyWalking增长势头强劲, 社区活跃, 中文文档齐全, 没有语言障碍, 支持多语言探针, 这些都是 SkyWalking的优势所在, 还有就是SkyWalking支持很多框架, 包括很多国产框架, 例如, Dubbo、 gRPC、 SOFARPC 等等, 同时也有很多开发者正在不断向社区提供更多插件以支持更多组件无缝接入SkyWalking。
官网地址:https://skywalking.apache.org/
skywalking特点简介
- 实现从请求跟踪、 指标收集和日志记录的完整信息记录。
- 多语言自动探针, 支持Java、 GO、 Python、 PHP、 NodeJS、 LUA、 Rust等客户端。
- 内置服务网格可观察性, 支持从Istio+Envoy Service Mesh收集和分析数据。
- 模块化架构, 存储、 集群管理、 使用插件集合都可以进行自由选择。
- 支持告警。
- 优秀的可视化效果。
skywalking与其他特性对比
skywalking组件逻辑架构
- OAP平台(Observability Analysis Platform, 可观测性分析平台)或OAP Server, 它是一个高度组件化的轻量级分析程序, 由兼容各种探针Receiver、 流式分析内核和查询内核三部分构成。
- 探针: 基于无侵入式的收集, 并通过HTTP或者gRPC方式发送数据到OAP Server。
- 存储实现(Storage Implementors), SkyWalking OAP Server支持多种存储实现并且提供了标准接口, 可支持不同的存储后端。
- UI模块(SkyWalking), 通过标准的GraphQL(Facebook在2012年开源)协议进行统计数据查询和展示 。
skywalking探针协议
- 探针上报协议: 协议包括语言探针的注册、 Metrics数据上报、 Tracing数据据上报等标准, Java、 Go等探针都需要严格遵守此协议的标准。
- 探针交互协议: 因为分布式追踪环境, 探针间需要借助HTTP Header、 MQ Header在应用之间进行通信和交互, 探针交互协议就定义了交互的数据格式。
- Service Mesh协议: 是SkyWalking对Service Mesh抽象的专有协议, 任何Mesh类的服务都可以通过此协议直接上传指标数据, 用于计算服务的指标数据和绘制拓扑图。
- 第三方协议: 对大型的第三方开源项目 尤其是Service Mesh核心平台Istio和Envoy,提供核心协议适配,支持针对Istio+Envoy Service Mesh进行无缝对接
skywalking数据查询协议
- 元数据查询: 查询在SkyWalking注册的服务、 服务实例、 Endpoint等元数据信息。
- 拓扑关系查询: 查询全局、 或者单个服务、 Endpoint的拓扑图及依赖关系。
- Metrics指标查询: 查询指标数据。
- 聚合指标查询: 区间范围均值查询及Top N排名数据查询等。
- Trace查询: 追踪数据的明细查询。
- 告警查询: 基于表达式, 判断指标数据是否超出阈值。
skywalking优势
兼容性好
- 支持传统的分部署架构dubbo和spring cloud, 也支持云原生中的Istio和envoy。
易于部署和后期维护
- 组件化, 可以自定义部署, 后期横向扩容简单
高性能
- 每天数T的数据无压力
易于二次开发
- 标准的http和grpc协议, 开源的项目, 企业可以自主二次开发
二、部署skywalking
2.1、二进制方式部署
架构规划:
- skywalking-ui: 前端服务,端口号8080。
- skywalking-oap(Observability Analysis Platform): 可观测性分析平台,11800为数据写入端口, 12800为查询端口。
- es: 9200为elasticsearch的数据读写端口, skywalking支持的存储有elasticsearch、 h2、 mysql、 tidb、influxdb、 postgresql等。
- agent: app服务器部署skywalking agent, 用于收集app中的访问请求。
下载elasticsearch安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-amd64.deb
dpkg -i elasticsearch-7.10.2-amd64.deb
配置elasticsearch服务
vi /etc/elasticsearch/elasticsearch.yml
grep -Ev "^$|^#" /etc/elasticsearch/elasticsearch.yml
cluster.name: skywalking-es-cluster node.name: skywalking-es-01 path.data: /var/lib/elasticsearch path.logs: /var/log/elasticsearch network.host: 172.16.88.186 http.port: 9200 discovery.seed_hosts: ["172.16.88.186"] cluster.initial_master_nodes: ["172.16.88.186"]
systemctl enable --now elasticsearch.service
安装skywalking
apt install openjdk-11-jdk -y
wget https://archive.apache.org/dist/skywalking/8.6.0/apache-skywalking-apm-es7-8.6.0.tar.gz
mkdir /apps
tar -xf apache-skywalking-apm-es7-8.6.0.tar.gz -C /apps
cd /apps/apache-skywalking-apm-bin-es7/
vim config/application.yml
验证skywalking 服务
2.2、docker-compose方式部署
安装docker
[root@cyh-dell-rocky-8-6 software]# scp docker-20.10.17-binary-install.tar.gz root@172.16.88.187:/root
[root@skywalking-docker-compose-01 ~]# mkdir /apps
[root@skywalking-docker-compose-01 ~]# mv docker-20.10.17-binary-install.tar.gz /apps/
[root@skywalking-docker-compose-01 apps]# mkdir docker
[root@skywalking-docker-compose-01 apps]# tar -xf docker-20.10.17-binary-install.tar.gz -C docker/
[root@skywalking-docker-compose-01 docker]# ll -h total 74M drwxr-xr-x 2 root root 4.0K Oct 1 10:38 ./ drwxr-xr-x 3 root root 4.0K Oct 1 10:38 ../ -rw-r--r-- 1 root root 647 Apr 11 2021 containerd.service -rw-r--r-- 1 root root 356 Jul 18 11:09 daemon.json -rw-r--r-- 1 root root 62M Jun 7 08:42 docker-20.10.17.tgz -rwxr-xr-x 1 root root 12M Dec 7 2021 docker-compose-Linux-x86_64_1.28.6* -rwxr-xr-x 1 root root 2.9K Jul 21 07:29 docker-install.sh* -rw-r--r-- 1 root root 1.7K Apr 11 2021 docker.service -rw-r--r-- 1 root root 197 Apr 11 2021 docker.socket -rw-r--r-- 1 root root 454 Apr 11 2021 limits.conf -rw-r--r-- 1 root root 257 Apr 11 2021 sysctl.conf [root@skywalking-docker-compose-01 docker]# [root@skywalking-docker-compose-01 docker]# [root@skywalking-docker-compose-01 docker]# cat docker-install.sh #!/bin/bash DIR=`pwd` PACKAGE_NAME="docker-20.10.17.tgz" DOCKER_FILE=${DIR}/${PACKAGE_NAME} centos_install_docker(){ grep "Kernel" /etc/issue &> /dev/null if [ $? -eq 0 ];then /bin/echo "当前系统是`cat /etc/redhat-release`,即将开始系统初始化、配置docker-compose与安装docker" && sleep 1 systemctl stop firewalld && systemctl disable firewalld && echo "防火墙已关闭" && sleep 1 systemctl stop NetworkManager && systemctl disable NetworkManager && echo "NetworkManager" && sleep 1 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux && setenforce 0 && echo "selinux 已关闭" && sleep 1 \cp ${DIR}/limits.conf /etc/security/limits.conf \cp ${DIR}/sysctl.conf /etc/sysctl.conf /bin/tar xvf ${DOCKER_FILE} \cp docker/* /usr/bin mkdir /etc/docker && \cp daemon.json /etc/docker \cp containerd.service /lib/systemd/system/containerd.service \cp docker.service /lib/systemd/system/docker.service \cp docker.socket /lib/systemd/system/docker.socket \cp ${DIR}/docker-compose-Linux-x86_64_1.28.6 /usr/bin/docker-compose groupadd docker && useradd docker -s /sbin/nologin -g docker id -u magedu &> /dev/null if [ $? -ne 0 ];then useradd magedu usermod magedu -G docker else usermod magedu -G docker fi systemctl enable containerd.service && systemctl restart containerd.service systemctl enable docker.service && systemctl restart docker.service systemctl enable docker.socket && systemctl restart docker.socket fi } ubuntu_install_docker(){ grep "Ubuntu" /etc/issue &> /dev/null if [ $? -eq 0 ];then /bin/echo "当前系统是`cat /etc/issue`,即将开始系统初始化、配置docker-compose与安装docker" && sleep 1 \cp ${DIR}/limits.conf /etc/security/limits.conf \cp ${DIR}/sysctl.conf /etc/sysctl.conf /bin/tar xvf ${DOCKER_FILE} \cp docker/* /usr/bin mkdir /etc/docker && \cp daemon.json /etc/docker \cp containerd.service /lib/systemd/system/containerd.service \cp docker.service /lib/systemd/system/docker.service \cp docker.socket /lib/systemd/system/docker.socket \cp ${DIR}/docker-compose-Linux-x86_64_1.28.6 /usr/bin/docker-compose #ulimit -n 1000000 #/bin/su -c - jack "ulimit -n 1000000" /bin/echo "docker 安装完成!" && sleep 1 groupadd docker && useradd docker -r -m -s /sbin/nologin -g docker id -u magedu &> /dev/null if [ $? -ne 0 ];then groupadd -r magedu useradd -r -m -g magedu magedu usermod magedu -G docker else usermod magedu -G docker fi systemctl enable containerd.service && systemctl restart containerd.service systemctl enable docker.service && systemctl restart docker.service systemctl enable docker.socket && systemctl restart docker.socket fi } main(){ centos_install_docker ubuntu_install_docker } main [root@skywalking-docker-compose-01 docker]#
[root@skywalking-docker-compose-01 docker]# bash docker-install.sh
[root@skywalking-docker-compose-01 docker]# docker info Client: Context: default Debug Mode: false Server: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 20.10.17 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 1 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc Default Runtime: runc Init Binary: docker-init containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1 runc version: v1.1.2-0-ga916309f init version: de40ad0 Security Options: apparmor seccomp Profile: default Kernel Version: 5.4.0-122-generic Operating System: Ubuntu 20.04.4 LTS OSType: linux Architecture: x86_64 CPUs: 4 Total Memory: 7.771GiB Name: skywalking-docker-compose-01 ID: DPSA:F22D:TB2V:FLLS:JLPJ:AWB5:PRTG:IZIP:76R2:QVGK:SLFM:CPZX Docker Root Dir: /var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 172.31.7.105 harbor.magedu.com harbor.myserver.com 127.0.0.0/8 Registry Mirrors: https://9916w1ow.mirror.aliyuncs.com/ Live Restore Enabled: false Product License: Community Engine WARNING: No swap limit support [root@skywalking-docker-compose-01 docker]#
[root@skywalking-docker-compose-01 ~]# mkdir /apps/skywalking-docker-compose
[root@skywalking-docker-compose-01 ~]# vi /apps/skywalking-docker-compose/docker-compose.yaml
version: '3.3' services: es7: image: elasticsearch:7.10.1 container_name: es7 ports: - 9200:9200 - 9300:9300 environment: - discovery.type=single-node #单机模式 - bootstrap.memory_lock=true #锁定物理内存地址 - "ES_JAVA_OPTS=-Xms1048m -Xmx1048m" #堆内存大小 - TZ=Asia/Shanghai ulimits: memlock: soft: -1 hard: -1 volumes: - /data/elasticsearch/data:/usr/share/elasticsearch/data skywalking-oap: image: apache/skywalking-oap-server:8.6.0-es7 container_name: skywalking-oap restart: always depends_on: - es7 links: - es7 ports: - 11800:11800 - 12800:12800 environment: TZ: Asia/Shanghai SW_STORAGE: elasticsearch7 SW_STORAGE_ES_CLUSTER_NODES: es7:9200 skywalking-ui: image: apache/skywalking-ui:8.6.0 container_name: skywalking-ui restart: always depends_on: - skywalking-oap links: - skywalking-oap ports: - 8080:8080 environment: TZ: Asia/Shanghai SW_OAP_ADDRESS: skywalking-oap:12800
[root@skywalking-docker-compose-01 ~]# mkdir -p /data/elasticsearch/data
[root@skywalking-docker-compose-01 ~]# chmod -R 777 /data/elasticsearch/data/
[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose up -d Creating network "skywalking-docker-compsoe_default" with the default driver Pulling es7 (elasticsearch:7.10.1)... 7.10.1: Pulling from library/elasticsearch 3c72a8ed6814: Pull complete e0812c7c6d71: Pull complete ae1d3d20a65c: Pull complete f38df76a58b2: Pull complete 2eca3bea9f3c: Pull complete 8d0e26c84dc9: Pull complete 739cff10e6d4: Pull complete ebb4b2f0826b: Pull complete a93ad4ceb967: Pull complete Digest: sha256:7cd88158f6ac75d43b447fdd98c4eb69483fa7bf1be5616a85fe556262dc864a Status: Downloaded newer image for elasticsearch:7.10.1 Pulling skywalking-oap (apache/skywalking-oap-server:8.6.0-es7)... 8.6.0-es7: Pulling from apache/skywalking-oap-server 188c0c94c7c5: Pull complete ddbf802dc94d: Pull complete 0689e19f6d5e: Pull complete 0c2f7a8d8a71: Pull complete 694b9d84d875: Pull complete Digest: sha256:6d93a7a1d8f678b5a20f1acf567a7b2e998dd24361ff0001381762f18c84dbf2 Status: Downloaded newer image for apache/skywalking-oap-server:8.6.0-es7 Pulling skywalking-ui (apache/skywalking-ui:8.6.0)... 8.6.0: Pulling from apache/skywalking-ui 188c0c94c7c5: Already exists ddbf802dc94d: Already exists 0689e19f6d5e: Already exists d1645cf88195: Pull complete bfde0bf9e10b: Pull complete Digest: sha256:9d429cbeedbbd863a78293e8c9f0e4edddde76b39134712fa1eeb8d1fd74880e Status: Downloaded newer image for apache/skywalking-ui:8.6.0 Creating es7 ... done Creating skywalking-oap ... done Creating skywalking-ui ... done [root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose ps -a Name Command State Ports -------------------------------------------------------------------------------------------------------------------------------------------------------------- es7 /tini -- /usr/local/bin/do ... Up 0.0.0.0:9200->9200/tcp,:::9200->9200/tcp, 0.0.0.0:9300->9300/tcp,:::9300->9300/tcp skywalking-oap bash docker-entrypoint.sh Up 0.0.0.0:11800->11800/tcp,:::11800->11800/tcp, 1234/tcp, 0.0.0.0:12800->12800/tcp,:::12800->12800/tcp skywalking-ui bash docker-entrypoint.sh Up 0.0.0.0:8080->8080/tcp,:::8080->8080/tcp [root@skywalking-docker-compose-01 skywalking-docker-compose]#
访问GUI页面验证server
三、skywalking监控应用服务案例
3.1、监控java程序halo博客网站
准备一台skywalking-agent机器
mkdir /data
wget https://archive.apache.org/dist/skywalking/java-agent/8.8.0/apache-skywalking-java-agent-8.8.0.tgz
tar -xf apache-skywalking-java-agent-8.8.0.tgz
apt install openjdk-11-jdk -y
[root@skywalking-agent-01 skywalking-agent]# vim config/agent.config
18 agent.namespace=${SW_AGENT_NAMESPACE:halo } 21 agent.service_name=${SW_AGENT_NAME:halo}
93 collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:172.16.88.187:11800}
[root@skywalking-agent-01 skywalking-agent]# cd
[root@skywalking-agent-01 ~]# mkdir /apps
[root@skywalking-agent-01 ~]# cd /apps/
[root@skywalking-agent-01 apps]# wget https://dl.halo.run/release/halo-1.5.4.jar
[root@skywalking-agent-01 ~]# java -javaagent:/data/skywalking-agent/skywalking-agent.jar -jar /apps/halo-1.5.4.jar DEBUG 2022-10-01 11:54:45:495 main AgentPackagePath : The beacon class location is jar:file:/data/skywalking-agent/skywalking-agent.jar!/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.class. INFO 2022-10-01 11:54:45:499 main SnifferConfigInitializer : Config file found in /data/skywalking-agent/config/agent.config. __ __ __ / / / /___ _/ /___ / /_/ / __ `/ / __ \ / __ / /_/ / / /_/ / /_/ /_/\__,_/_/\____/ Version: 1.5.4 2022-10-01 11:54:53.038 INFO 6018 --- [ main] run.halo.app.Application : Starting Application v1.5.4 using Java 11.0.16 on skywalking-agent-01 with PID 6018 (/apps/halo-1.5.4.jar started by root in /root) 2022-10-01 11:54:53.044 INFO 6018 --- [ main] run.halo.app.Application : No active profile set, falling back to 1 default profile: "default" 2022-10-01 11:54:58.174 INFO 6018 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2022-10-01 11:54:58.175 INFO 6018 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode. 2022-10-01 11:55:01.685 INFO 6018 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3483 ms. Found 24 JPA repository interfaces. 2022-10-01 11:55:04.809 INFO 6018 --- [ main] org.eclipse.jetty.util.log : Logging initialized @19801ms to org.eclipse.jetty.util.log.Slf4jLog 2022-10-01 11:55:06.267 INFO 6018 --- [ main] o.s.b.w.e.j.JettyServletWebServerFactory : Server initialized with port: 8090 2022-10-01 11:55:06.295 INFO 6018 --- [ main] org.eclipse.jetty.server.Server : jetty-9.4.45.v20220203; built: 2022-02-03T09:14:34.105Z; git: 4a0c91c0be53805e3fcffdcdcc9587d5301863db; jvm 11.0.16+8-post-Ubuntu-0ubuntu120.04 2022-10-01 11:55:06.381 INFO 6018 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring embedded WebApplicationContext 2022-10-01 11:55:06.381 INFO 6018 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 13184 ms 2022-10-01 11:55:09.147 INFO 6018 --- [ main] run.halo.app.config.HaloConfiguration : Halo cache store load impl : [class run.halo.app.cache.InMemoryCacheStore] 2022-10-01 11:55:13.963 INFO 6018 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] 2022-10-01 11:55:14.390 INFO 6018 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.33 2022-10-01 11:55:14.706 INFO 6018 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final} 2022-10-01 11:55:16.107 INFO 6018 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2022-10-01 11:55:17.324 INFO 6018 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2022-10-01 11:55:17.762 INFO 6018 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect 2022-10-01 11:55:21.235 INFO 6018 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] 2022-10-01 11:55:21.304 INFO 6018 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 2022-10-01 11:55:24.490 INFO 6018 --- [ main] org.eclipse.jetty.server.session : DefaultSessionIdManager workerName=node0 2022-10-01 11:55:24.491 INFO 6018 --- [ main] org.eclipse.jetty.server.session : No SessionScavenger set, using defaults 2022-10-01 11:55:24.496 INFO 6018 --- [ main] org.eclipse.jetty.server.session : node0 Scavenging every 600000ms 2022-10-01 11:55:24.523 INFO 6018 --- [ main] o.e.jetty.server.handler.ContextHandler : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext@104392ba{application,/,[file:///tmp/jetty-docbase.8090.9226732139990819185/, jar:file:/apps/halo-1.5.4.jar!/BOOT-INF/lib/springfox-swagger-ui-3.0.0.jar!/META-INF/resources],AVAILABLE} 2022-10-01 11:55:24.524 INFO 6018 --- [ main] org.eclipse.jetty.server.Server : Started @39522ms 2022-10-01 11:55:29.012 INFO 6018 --- [ main] run.halo.app.handler.file.FileHandlers : Registered 9 file handler(s) 2022-10-01 11:55:33.112 INFO 6018 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 4 endpoint(s) beneath base path '/api/admin/actuator' 2022-10-01 11:55:33.219 INFO 6018 --- [ main] o.e.j.s.h.ContextHandler.application : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-10-01 11:55:33.220 INFO 6018 --- [ main] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-10-01 11:55:33.222 INFO 6018 --- [ main] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms 2022-10-01 11:55:33.264 INFO 6018 --- [ main] o.e.jetty.server.AbstractConnector : Started ServerConnector@6f1c3f18{HTTP/1.1, (http/1.1)}{0.0.0.0:8090} 2022-10-01 11:55:33.268 INFO 6018 --- [ main] o.s.b.web.embedded.jetty.JettyWebServer : Jetty started on port(s) 8090 (http/1.1) with context path '/' 2022-10-01 11:55:33.359 INFO 6018 --- [ main] run.halo.app.Application : Started Application in 44.094 seconds (JVM running for 48.356) 2022-10-01 11:55:33.363 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Starting migrate database... 2022-10-01 11:55:33.622 INFO 6018 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 7.15.0 by Redgate 2022-10-01 11:55:33.624 INFO 6018 --- [ main] o.f.c.i.database.base.BaseDatabaseType : Database: jdbc:h2:file:/root/.halo//db/halo (H2 1.4) 2022-10-01 11:55:33.722 INFO 6018 --- [ main] o.f.c.i.s.JdbcTableSchemaHistory : Repair of failed migration in Schema History table "PUBLIC"."flyway_schema_history" not necessary as table doesn't exist. 2022-10-01 11:55:33.778 INFO 6018 --- [ main] o.f.core.internal.command.DbRepair : Successfully repaired schema history table "PUBLIC"."flyway_schema_history" (execution time 00:00.080s). 2022-10-01 11:55:33.797 INFO 6018 --- [ main] o.f.c.internal.license.VersionPrinter : Flyway Community Edition 7.15.0 by Redgate 2022-10-01 11:55:33.828 INFO 6018 --- [ main] o.f.core.internal.command.DbValidate : Successfully validated 6 migrations (execution time 00:00.018s) 2022-10-01 11:55:33.874 INFO 6018 --- [ main] o.f.c.i.s.JdbcTableSchemaHistory : Creating Schema History table "PUBLIC"."flyway_schema_history" with baseline ... 2022-10-01 11:55:34.023 INFO 6018 --- [ main] o.f.core.internal.command.DbBaseline : Successfully baselined schema with version: 1 2022-10-01 11:55:34.060 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Current version of schema "PUBLIC": 1 2022-10-01 11:55:34.071 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version "2 - migrate 1.2.0-beta.1 to 1.2.0-beta.2" 2022-10-01 11:55:34.163 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version "3 - migrate 1.3.0-beta.1 to 1.3.0-beta.2" 2022-10-01 11:55:34.308 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version "4 - migrate 1.3.0-beta.2 to 1.3.0-beta.3" 2022-10-01 11:55:34.363 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version "5 - migrate remove notnull for email in comments table" 2022-10-01 11:55:34.418 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "PUBLIC" to version "6 - migrate create contents table" 2022-10-01 11:55:34.484 INFO 6018 --- [ main] o.f.core.internal.command.DbMigrate : Successfully applied 5 migrations to schema "PUBLIC", now at version v6 (execution time 00:00.450s) 2022-10-01 11:55:34.489 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Migrate database succeed. 2022-10-01 11:55:34.490 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Created backup directory: [/tmp/halo-backup] 2022-10-01 11:55:34.491 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Created data export directory: [/tmp/halo-data-export] 2022-10-01 11:55:34.833 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Copied theme folder from [/BOOT-INF/classes/templates/themes] to [/root/.halo/templates/themes/caicai_anatole] 2022-10-01 11:55:34.915 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Halo started at http://127.0.0.1:8090 2022-10-01 11:55:34.915 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Halo admin started at http://127.0.0.1:8090/admin 2022-10-01 11:55:34.915 INFO 6018 --- [ main] run.halo.app.listener.StartedListener : Halo has started successfully!
验证skywalking监控界面
skywalking仪表盘简介:
- global: 显示服务的全局统计详情。
- 服务(Service)-表示对请求提供相同行为的一系列或一组工作负载(服务名称),在使用Agent或SDK的时候,可以自定义服务的名字,如果不定义的话,SkyWalking将会使用你在平台(例如说 Istio)上定义的名字。
- 服务实例(Instance)-上述的一组工作负载中的每一个工作负载称为一个实例(一个服务运行的节点),一个服务实例可以是一个kubernetes中的pod或者是一个虚拟机甚至是物理机 。
- 端点(Endpoint) : 对于特定服务所接收的请求路径, 如HTTP的URI路径和gRPC服务的类 +方法签名, 如/api/v1/
- CPM-calls per minute: 服务平均每分钟请求数
- Slow Services ms: 慢响应服务, 单位ms
- Un-Health services(Apdex): Apdex 性能指标, 1为满分
- Slow Endpoints(ms): 全局维度的慢响应端点(API),例如一个接口, 显示的是全局慢响应Top N的数据,通过这个可以观测平台性能情况。
- Global Response Latency(percentile inms): 全局响应延迟百分位数统计, 单位ms。
- Global Heatmap: 服务响应时间热力分布图, 根据当时时间段内不同响应时间(0ms、 100ms)的数量用不同的颜色表示。
skywalking仪表盘-service简介:
- Service Apdex(数字) :当前服务的评分
- Service Apdex(折线图) : 一段时间内Apdex评分
- Service Avg Response Times(ms) : 平均响应延时,单位ms
- Service Response Time Percentile: 百分比响应延时,参考Global Response Latency(percentile in ms)
- Successful Rate(数字) : 请求成功率
- Successful Rate(折线图) : 一段时间的请求成功率
- Servce Load(CPM / PPM) (数字) : 每分钟请求数,
- Servce Load(CPM / PPM) (折线图) : 不同时间的每分钟请求数
- Service Throughput (Bytes) : 该指标只适用于TCP 服务。 当前服务的吞吐量。
- Servce Instances Load(CPM / PPM) : 每个服务实例的每分钟请求数
- Show Service Instance: 每个 服务 实例 的最大延时
- Service Instance Successful Rate: 每个服务实例的请求成功率
skywalking仪表盘-instance简介:
- Service Instance Load (CPM / PPM) : 当前实例的每分钟请求数。
- Service Instance Throughput (Bytes) : 该指标只适用于TCP 服务,显示当前服务实例的吞吐量。
- Service Instance Successful Rate(%) : 当前实例的请求成功率。
- Service Instance Latency(ms) : 当前实例的响应延时。
- JVM CPU(Java Service) : jvm占用CPU的百分比。
- JVM Memory (Java Service): JVM内存占用大小, 单位m, 包括堆内存, 与堆外内存(直接内存) 。
- JVM GC Time(ms) : JVM垃圾回收时间, 包含YGC和OGC。
- JVM GC Count: JVM垃圾回收次数, 包含YGC和OGC
- JVM Thread Count (Java Service)。
skywalking仪表盘-endpoint简介:
端点整体统计:
- Endpoint Load in Current Service(CPM /PPM) : 每个端点(API) 每分钟请求数
- Slow Endpoints in Current Service(ms) :每个端点(API) 的最慢响应请求时间, 单位ms
- Successful Rate in Current Service(%) :每个端点(API) 的请求成功率
当前端点统计:
- Endpoint Load: 当前端点每个时间段的请求数据
- Endpoint Avg Response Time: 当前端点每个时间段的请求行响应时间
- Endpoint Response Time Percentile(ms) :当前端点每个时间段的响应时间占比
- Endpoint Successful Rate(%) : 当前端点每个时间段的请求成功率
skywalking仪表盘-database简介:
- Database Avg Response Time(ms) : 当前数据库事件平均响应时间, 单位ms
- Database Access Successful Rate(%) :当前数据库访问成功率
- Database Traffic(CPM: Calls PerMinute) : 当前数据库每分钟请求数
- Database Access Latency Percentile(ms) : 数据库不同比例的响应时间, 单位ms
- Slow Statements(ms) : 前N个慢查询,单位ms
- All Database Loads(CPM: Calls PerMinute) : 所有数据库中请求量排序
- Un-Health Databases: 所有数据库不健康排名, 请求成功率排名, 失败最多的请求在最上。
3.2、监控基于tomcat运行jenkins java程序服务
准备skywalking-agent-02机器
安装jdk
[root@skywalking-agent-02 apps]# apt-get update && apt install openjdk-11-jdk -y
[root@skywalking-agent-02 ~]# mkdir /data
[root@skywalking-agent-02 ~]# mkdir /apps
[root@skywalking-agent-01 ~]# scp -r /data/skywalking-agent/ root@172.16.88.189:/data
[root@skywalking-agent-02 apps]# wget https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.82/bin/apache-tomcat-8.5.82.tar.gz
[root@skywalking-agent-02 apps]# tar -xf apache-tomcat-8.5.82.tar.gz
[root@skywalking-agent-02 apps]# vim apache-tomcat-8.5.82/bin/catalina.sh
................................ 123 # case the default is "true" 124 # ----------------------------------------------------------------------------- 125 126 CATALINA_OPTS="$CATALINA_OPTS -javaagent:/data/skywalking-agent/skywalking-agent.jar" 127 # OS specific support. $var _must_ be set to either true or false. 128 cygwin=false 129 darwin=false ...............................
[root@skywalking-agent-02 apps]# vim /data/skywalking-agent/config/agent.config
18 agent.namespace=${SW_AGENT_NAMESPACE:jenkins} 21 agent.service_name=${SW_AGENT_NAME:jenkins} 93 collector.backend_service=${SW_AGENT_COLLECTOR_BACKEND_SERVICES:172.16.88.187:11800}
准备jenkins war包
cd /apps/apache-tomcat-8.5.82/webapps
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/war/2.361/jenkins.war
[root@skywalking-agent-02 ~]# /apps/apache-tomcat-8.5.82/bin/catalina.sh run
[root@skywalking-agent-02 ~]# /apps/apache-tomcat-8.5.82/bin/catalina.sh run Using CATALINA_BASE: /apps/apache-tomcat-8.5.82 Using CATALINA_HOME: /apps/apache-tomcat-8.5.82 Using CATALINA_TMPDIR: /apps/apache-tomcat-8.5.82/temp Using JRE_HOME: /usr Using CLASSPATH: /apps/apache-tomcat-8.5.82/bin/bootstrap.jar:/apps/apache-tomcat-8.5.82/bin/tomcat-juli.jar Using CATALINA_OPTS: -javaagent:/data/skywalking-agent/skywalking-agent.jar NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED DEBUG 2022-10-01 14:54:00:616 main AgentPackagePath : The beacon class location is jar:file:/data/skywalking-agent/skywalking-agent.jar!/org/apache/skywalking/apm/agent/core/boot/AgentPackagePath.class. INFO 2022-10-01 14:54:00:621 main SnifferConfigInitializer : Config file found in /data/skywalking-agent/config/agent.config. 01-Oct-2022 14:54:08.803 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version name: Apache Tomcat/8.5.82 01-Oct-2022 14:54:08.821 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Aug 8 2022 21:26:07 UTC 01-Oct-2022 14:54:08.821 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version number: 8.5.82.0 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 5.4.0-122-generic 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /usr/lib/jvm/java-11-openjdk-amd64 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 11.0.16+8-post-Ubuntu-0ubuntu120.04 01-Oct-2022 14:54:08.822 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Ubuntu 01-Oct-2022 14:54:08.823 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /apps/apache-tomcat-8.5.82 01-Oct-2022 14:54:08.823 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /apps/apache-tomcat-8.5.82 01-Oct-2022 14:54:08.824 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED 01-Oct-2022 14:54:08.824 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED 01-Oct-2022 14:54:08.824 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/apps/apache-tomcat-8.5.82/conf/logging.properties 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 01-Oct-2022 14:54:08.825 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/data/skywalking-agent/skywalking-agent.jar 01-Oct-2022 14:54:08.826 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 01-Oct-2022 14:54:08.826 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/apps/apache-tomcat-8.5.82 01-Oct-2022 14:54:08.828 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/apps/apache-tomcat-8.5.82 01-Oct-2022 14:54:08.828 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/apps/apache-tomcat-8.5.82/temp 01-Oct-2022 14:54:08.829 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib] 01-Oct-2022 14:54:09.061 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 01-Oct-2022 14:54:09.151 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2744 ms 01-Oct-2022 14:54:09.385 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 01-Oct-2022 14:54:09.386 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: [Apache Tomcat/8.5.82] 01-Oct-2022 14:54:09.479 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/apps/apache-tomcat-8.5.82/webapps/jenkins.war] 01-Oct-2022 14:54:22.077 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 01-Oct-2022 14:54:24.620 INFO [localhost-startStop-1] hudson.WebAppMain.contextInitialized Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins 01-Oct-2022 14:54:25.451 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/apps/apache-tomcat-8.5.82/webapps/jenkins.war] has finished in [15,968] ms 01-Oct-2022 14:54:25.471 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/apps/apache-tomcat-8.5.82/webapps/examples] 01-Oct-2022 14:54:26.058 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/apps/apache-tomcat-8.5.82/webapps/examples] has finished in [586] ms 01-Oct-2022 14:54:26.064 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/apps/apache-tomcat-8.5.82/webapps/docs] 01-Oct-2022 14:54:26.179 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/apps/apache-tomcat-8.5.82/webapps/docs] has finished in [115] ms 01-Oct-2022 14:54:26.180 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/apps/apache-tomcat-8.5.82/webapps/ROOT] 01-Oct-2022 14:54:26.229 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/apps/apache-tomcat-8.5.82/webapps/ROOT] has finished in [49] ms 01-Oct-2022 14:54:26.230 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/apps/apache-tomcat-8.5.82/webapps/manager] 01-Oct-2022 14:54:26.402 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/apps/apache-tomcat-8.5.82/webapps/manager] has finished in [172] ms 01-Oct-2022 14:54:26.404 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/apps/apache-tomcat-8.5.82/webapps/host-manager] 01-Oct-2022 14:54:26.464 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/apps/apache-tomcat-8.5.82/webapps/host-manager] has finished in [59] ms 01-Oct-2022 14:54:26.482 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 01-Oct-2022 14:54:26.557 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 17402 ms 01-Oct-2022 14:54:27.558 INFO [pool-7-thread-3] jenkins.InitReactorRunner$1.onAttained Started initialization 01-Oct-2022 14:54:27.583 INFO [pool-7-thread-1] jenkins.InitReactorRunner$1.onAttained Listed all plugins 01-Oct-2022 14:54:32.764 INFO [pool-7-thread-2] jenkins.InitReactorRunner$1.onAttained Prepared all plugins 01-Oct-2022 14:54:32.809 INFO [pool-7-thread-5] jenkins.InitReactorRunner$1.onAttained Started all plugins 01-Oct-2022 14:54:32.841 INFO [pool-7-thread-5] jenkins.InitReactorRunner$1.onAttained Augmented all extensions 01-Oct-2022 14:54:34.729 INFO [pool-7-thread-5] jenkins.InitReactorRunner$1.onAttained System config loaded 01-Oct-2022 14:54:34.737 INFO [pool-7-thread-7] jenkins.InitReactorRunner$1.onAttained System config adapted 01-Oct-2022 14:54:34.739 INFO [pool-7-thread-2] jenkins.InitReactorRunner$1.onAttained Loaded all jobs 01-Oct-2022 14:54:34.750 INFO [pool-7-thread-3] jenkins.InitReactorRunner$1.onAttained Configuration for all jobs updated 01-Oct-2022 14:54:34.838 INFO [Download metadata thread] hudson.model.AsyncPeriodicWork.lambda$doRun$1 Started Download metadata 01-Oct-2022 14:54:34.965 INFO [Download metadata thread] hudson.util.Retrier.start Attempt #1 to do the action check updates server WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/apps/apache-tomcat-8.5.82/webapps/jenkins/WEB-INF/lib/groovy-all-2.4.21.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int) WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release 01-Oct-2022 14:54:38.804 INFO [Finalizing set up] jenkins.install.SetupWizard.init ************************************************************* ************************************************************* ************************************************************* Jenkins initial setup is required. An admin user has been created and a password generated. Please use the following password to proceed to installation: e5a0d9608a494115a4ca494a3bb369c2 This may also be found at: /root/.jenkins/secrets/initialAdminPassword ************************************************************* ************************************************************* *************************************************************
http://172.16.88.189:8080/jenkins/验证skywalking server端是否有新的数据采集到