当前位置:网站首页>Microservice system design -- microservice monitoring and system resource monitoring design
Microservice system design -- microservice monitoring and system resource monitoring design
2022-06-27 04:22:00 【Zhuangxiaoyan】
Abstract
Each micro service module is basically in place , But how is the system running , Is there any way to check it ? This article will take you to see how to view some information about the system runtime . Help development engineers sort problems , At the same time, it is also the protection of data monitoring and services provided by operation and maintenance engineers . This blog will introduce the monitoring function design of microservices .
One 、Actuator plug-in unit
The careful little friend found , Every microservice's pom There are the following in the file configuration jar quote , This is a Spring Boot Provides a series of additional feature components to help you monitor and manage running system applications .
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> In addition to introducing corresponding jar Outside the package , You also need to specify the configuration . Because only by default health、info Two API, Other API Use it normally , Need to exposure The configuration item is set to *, For normal use Actuator Exposed interfaces .
management.endpoints.web.exposure.include=*The picture below is Actuator All external interfaces provided , The four in the upper left corner are Web Application unique .

After starting any application , Enter web address in browser http://localhost:10065/actuator/ You can view all interface addresses , All response messages are in the form of JSON In the form of output . give an example , visit http://localhost:10065/actuator/metrics, The browser response information is as follows :

By visiting different addresses , You can get relevant information about the service , more Actuator Refer to for the component related documentation Spring Boot Actuator Introduction to official documents . But all the information returned by the plug-in is text information , Not intuitive enough , It takes a lot of energy for the monitor to interpret the information behind it .
Two 、Spring Boot Admin
Introduce here Spring Boot Admin, It's a Web application , Official website address :
GitHub - codecentric/spring-boot-admin: Admin UI for administration of spring boot applications,
It is based on Actutor, On top of it UI beautify , Usability is greatly improved for users , Let's experience it intuitively .



2.1 Create a new monitoring server
be based on Spring Boot Quickly build parking-admin Sub module ,pom.xml Add dependency in :
<properties>
<spring.boot.admin.version>2.1.2</spring.boot.admin.version>
</properties>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>application.yml The configuration file :
server:
port: 10090
management:
endpoints:
web:
exposure:
include: \\*
security:
enabled: false
endpoint:
health:
show-details: ALWAYS
spring:
application:
name: parking-admin
Applying the main class is also very simple , increase @EnableAdminServer Annotations can be :
@EnableAdminServer
@SpringBootApplication
public class BootAdminApplication {
public static void main(String[] args) {
SpringApplication.run(BootAdminApplication.class, args);
}
} After the application starts , The server is finished , Browser open localhost:8081 see Spring Boot Admin The main page : The page has been in Loading state , Directly to the monitored end application .

2.2 Add monitoring end application
Directly in the corresponding modules to be monitored , Introduce the corresponding client jar that will do .( Version suggestions and spring-boot-admin-starter-server bring into correspondence with )
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>Corresponding application.properties Add configuration :
# Must be exposed , Otherwise admin-server Can't get health data
management.endpoints.web.exposure.include=*
management.security.enabled=false
management.endpoint.health.show-details=ALWAYS
#admin server address
spring.boot.admin.client.url=http://localhost:10090Just two steps , Others do not need to be changed too much , Start the main program class , We serve resources as an example , Return to the monitoring page , You will find that the resource service instance has been monitored , And listed in the interface :

Click the application instance , Go to the more detailed information view , So far through Spring Boot Admin The application monitoring implemented can be used normally . Although monitoring has stepped out of the ranks of code development , But now DevOps、SRE Prevalence of concepts , The boundary between development and operation and maintenance becomes more and more blurred , Closer and closer cooperation , It is necessary to know some monitoring knowledge . in addition , Monitoring microservices is an indispensable part of any microservice architecture . but Spring Boot Admin Only the information of the application itself can be monitored , The host information to which the application belongs cannot be monitored , Do you know any way to monitor ?
3、 ... and 、grafana+prometheus Monitoring system resources
Blog reference
边栏推荐
- Penetration test - directory traversal vulnerability
- 第1章 绪论
- Argo workflows - getting started with kubernetes' workflow engine
- 第2章 关键技术介绍
- Ledrui ldr6035 usb-c interface device supports rechargeable OTG data transmission scheme.
- 笔记本电脑没有WiFi选项 解决办法
- 【Unity】UI交互组件之按钮Button&可选基类总结
- How to make ef core 6 support dateonly type
- Kotlin compose custom compositionlocalprovider compositionlocal
- ERP需求和销售管理 金蝶
猜你喜欢

日志收集系統

Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused

快速掌握 ASP.NET 身份认证框架 Identity - 通过邮件重置密码
![[BJDCTF2020]The mystery of ip](/img/f8/c3a7334252724635d42c8db3d1bbb0.png)
[BJDCTF2020]The mystery of ip

微服务系统设计——微服务调用设计

MATLAB | 基于分块图布局的三纵坐标图绘制

手撸promise【二、Promise源码】【代码详细注释/测试案例完整】

卷积神经网络(CNN)网络结构及模型原理介绍

2021:Greedy Gradient Ensemble for Robust Visual Question Answering

Products change the world
随机推荐
There are two problems when Nacos calls microservices: 1 Load balancer does not contain an instance for the service 2. Connection refused
DAST 黑盒漏洞扫描器 第六篇:运营篇(终)
Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused
MySQL development environment
微服务系统设计——服务熔断和降级设计
A^2=E | 方程的解 | 这个方程究竟能告诉我们什么
022 C语言基础:C内存管理与C命令行参数
【promise一】promise的介绍与手撸的关键问题
[BJDCTF2020]The mystery of ip
日志收集系統
缓存综合项目--秒杀架构
2022-06-26:以下golang代码输出什么?A:true;B:false;C:编译错误。 package main import “fmt“ func main() { type
Installing MySQL on Windows
008 C语言基础:C判断
如何系统学习LabVIEW?
Facing the "industry, University and research" gap in AI talent training, how can shengteng AI enrich the black land of industrial talents?
Learn crypto from Buu (Zhou Geng)
010 C语言基础:C函数
FastDDS的服务器记录-译-
Promise source code class version [III. promise source code] [detailed code comments / complete test cases]