Springboot 14 监控中心

1:什么是监控中心

针对微服务服务器监控,服务器内存变化(堆内存、线程、日志管理等)、检测服务配置连接地址是否可用(模拟访问、懒加载)、统计Spring容器中bean的数量、统计接口。

2:两种监控中心模式

1、Actuator:没有界面,返回json格式。

2、AdminUI:底层使用Actuator监控应用,实现可视化界面。

3:实例1(Actuator)

访问地址:http://ip:port/actuator

pom.xml文件添加依赖

<!--  actuator监控中心  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
application.yml添加配置

#通过下面的配置启用所有的监控端点,默认情况下,这些端点是禁用的;
management:
  endpoints:
    web:
      exposure:
        include: "*"

4:实例2(AdminUI)

1:server端

pom.xml添加依赖

<!--  支持admin-ui的关键配置  -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.2.2</version>
        </dependency>
添加注释,开启监控服务@EnableAdminServer


package com.zhaoy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import de.codecentric.boot.admin.server.config.EnableAdminServer;

@SpringBootApplication
@EnableAdminServer
public class App {
	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}
}

2:client端

pom.xml文件添加依赖

 <!--  支持admin-ui的关键配置  -->
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.2.2</version>
        </dependency>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot Cloud是一个基于Spring Boot的开发框架,用于构建分布式系统和微服务架构。它提供了一套简化的开发工具和组件,使得开发者可以更加方便地构建、部署和管理分布式系统。 Spring Boot Cloud主要包括以下几个核心组件: 1. 服务注册与发现:Spring Boot Cloud通过集成服务注册与发现组件(如Eureka、Consul等),实现了服务的自动注册与发现。开发者只需要在应用中添加相应的依赖和配置,就可以实现服务的自动注册和发现。 2. 负载均衡:Spring Boot Cloud通过集成负载均衡组件(如Ribbon、Zuul等),实现了请求的负载均衡。开发者只需要在应用中添加相应的依赖和配置,就可以实现请求的负载均衡,提高系统的性能和可用性。 3. 配置中心Spring Boot Cloud通过集成配置中心组件(如Config Server、Apollo等),实现了配置的集中管理。开发者只需要在应用中添加相应的依赖和配置,就可以实现配置的动态更新和管理。 4. 断路器:Spring Boot Cloud通过集成断路器组件(如Hystrix、Resilience4j等),实现了服务的容错和熔断。开发者只需要在应用中添加相应的依赖和配置,就可以实现服务的容错和熔断,提高系统的稳定性和可靠性。 5. 分布式追踪:Spring Boot Cloud通过集成分布式追踪组件(如Zipkin、Sleuth等),实现了分布式系统的请求链路追踪。开发者只需要在应用中添加相应的依赖和配置,就可以实现请求的跟踪和监控

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值