자바 웹 의 springboot 튜 토리 얼 의 31-Attuator 와 spring-boot-admin
4856 단어 JavaWebspringboot
springboot 핵심 주석 참조:https://www.ctolib.com/topics-138637.html
SBA
SBA 전 칭 spring boot admin 은 spring boot 응용 프로그램 을 관리 하고 감시 하 는 오픈 소스 프로젝트 로 admin-server 와 admin-client 두 구성 요소 로 나 뉜 다.admin-server 는 actuator 터미널 데 이 터 를 수집 하여 spring-boot-admin-ui 에 나타 나 고 이미 알 고 있 는 터미널 은 거의 진행 채집 되 며 spring-boot-admin 을 통 해 로그 단 계 를 동적 으로 전환 하고 로 그 를 내 보 낼 수 있다.hepdump 내 보 내기,각종 지표 모니터링 등
spring boot admin 은 단일 서비스 모니터링 과 동시에 클 러 스 터 모니터링 방안 도 제공 하여 eureka,consul,zookeeper 등 등록 센터 의 방식 으로 다 중 서비스 모니터링 과 관 리 를 실현 하도록 지원 합 니 다.
홈 페이지 문서 참조:http://codecentric.github.io/spring-boot-admin/2.0.0/
Spring Boot 프로젝트 에서 Spring Boot Admin 은 서버 엔 드 로 서 모니터링 되 어야 할 다른 응용 프로그램 은 Client 엔 드 로 서
우선 다 중 모듈 springboot 프로젝트 를 만 듭 니 다.참고 하 십시오.https://blog.csdn.net/t2080305/article/details/81625433
1,server 모듈:
pom.xml
de.codecentric
spring-boot-admin-starter-server
2.1.0
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
프로필,application.properties:
server.port = 8000
spring.application.name=Spring Boot Admin Server
spring.boot.admin.url=http://localhost:${server.port}
spring.jackson.serialization.indent_output=true
시작 클래스:
package com.sba.server;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by Chen Xiang
* Date: 2019/4/28
* Proj: multisba
*/
@SpringBootApplication
@EnableAdminServer
@Slf4j
public class SbaServerApplication {
public static void main(String[] args) {
SpringApplication.run(SbaServerApplication.class, args);
}
}
시작 하면 localhost:8000 을 통 해 서버 에 접근 할 수 있 습 니 다.
2,클 라 이언 트:
pom.xml
de.codecentric
spring-boot-admin-starter-client
2.1.0
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
프로필:
server.port=8001
spring.application.name=Admin Client
spring.boot.admin.client.url=http://localhost:8000
management.endpoints.web.exposure.include=*
시작 클래스:
package com.sba.client;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Created by Chen Xiang
* Date: 2019/4/28
* Proj: multisba
*/
@SpringBootApplication
@Slf4j
public class SbaClientApplication {
public static void main(String[] args) {
SpringApplication.run(SbaClientApplication.class, args);
}
}
클 라 이언 트 가 시작 되면 서버 에서 볼 수 있 습 니 다.
Spring Boot Admin 은 응용 정 보 를 도형 화 된 형식 으로 보 여 주 었 는데 이런 정 보 는 대부분 Spring Boot Actuator 가 제공 하 는 인터페이스 에서 나온다.
만약 에 저희 가 하나의 Spring Boot 응용 프로그램 을 사용한다 면 감 시 된 응용 프로그램 마다 Admin Server 의 주소 정 보 를 설정 해 야 합 니 다.응용 프로그램 이 Eureka 에 등록 되 어 있 으 면 모든 응용 프로그램 을 설정 할 필요 가 없 으 며,Spring Boot Admin 은 자동 으로 등록 센터 에서 응용 프로그램 에 관 한 정 보 를 캡 처 합 니 다.
만약 에 저희 가 Spring Cloud 의 서비스 발견 기능 을 사용 했다 면 Admin Client 클 라 이언 트 를 따로 추가 할 필요 가 없습니다.Spring Boot Server 만 있 으 면 다른 내용 은 자동 으로 설 정 됩 니 다.유레카 사용 가능.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
JavaWeb 파일 다운로드 기능 인스턴스 코드업무 중에 만난 파일을 다운로드하는 기능은 스스로 추출합니다. 코드가 간단합니다. 여러분에게 도움이 되었으면 합니다. 자, 말이 많지 않습니다. 코드를 올리십시오! 이상은 본고의 JavaWeb 파일을 다운로드한 코드...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.