1. 스프링 부트 관리자 소개
Spring Boot Admin Github 오픈 소스 주소 : https://github.com/codecentric/spring-boot-admin
주요 기능은 스프링 부팅 액추에이터를 기반으로 간단한 웹 UI 디스플레이를 제공하는 것입니다.
2. 프로젝트 사용 :
1. Maven 웹 프로젝트를 구축하십시오
2. POM 종속성 구성
<pectionency> <groupId> org.springframework.boot </groupid> <artifactid> 스프링-부트-스타터-web </artifactid> </fectionency> <groupIdency> <groupId> org.springframework.boot </groupid> <artifactid> spring-boot-starter-security </expencivactid> <groupid> de.codecentric </groupid> <artifactid> 스프링-부트-아드 민-스타터-클라이언트 </artifactid> </의존성> <pectionency> <groupid> de.codecentric </groupId> <artifactid> spring-boot-admin-server </artifactid> <pelection> <아티 팩트> 스프링-부츠-아드민-서버 -ui </artifactid> </eppendency> <pectomency> <groupId> de.codecentric </groupId> <trifactid> 스프링 부트-아드민-서버 -ui-login </artifactid> </decendency>
pom.xml에 위 구성을 추가하십시오
관리자 서버 : Spring-Boot-Admin-Server, Spring-Boot-Admin-Server-UI
관리자 클라이언트 : Spring-Boot-Admin-Starter-Client (이 항목은 서버 자체의 작동 상태를 모니터링 할 수 있습니다. 다른 프로젝트는 모니터링을 소개하기 위해 클라이언트를 소개하면됩니다).
보안 : 스프링 부트 스타터 보안
로그인 확인 : Spring-Boot-Admin-Server-Ui-Login (직접 간단한 로그인 인터페이스를 추가 할 수도 있음)
3. Application.yml
정보 : 이름 : imped 버전 : v1.0.0 [html] 평범한 복판보기 : "d : /logs/imard/boot.log"management : "/actuator"spring : application : "@pom.artifactid : admin : http://www.test.com:8080 profile-:-:-: :-: : : : : : : : : : :"@pom.artifactid : "@pom.artifactid :"@pom.artifactid : "@pom.artifactid :"@pom.artifactid " 프로파일 : 안전한 관리 : 보안 : 허위 보안 : 기본 : 활성화 : 거짓 --- 스프링 : 스프링 : 프로파일 : 보안 부팅 : 관리자 : admin : "$ {security.user.name}"암호 : "$ {security.user.password}"클라이언트 : user.name : "$ {security.user.name}"userford. " 사용자 비밀번호 : 통과 그 중 : spring.boot.admin.url은 관리자 서버 주소를 선언합니다 (다른 프로젝트는이 URL을 통해 관리자 모니터링에 적극적으로 등록합니다)
정보 구성 앱에 대한 기본 정보
www.test.com 네이티브 호스트의 매핑
4. Application.java
@configuration @enableautoconfiguration @enableadminserver public class 응용 프로그램 확장 springbootservletinitializer {@override protected springApplicationBuilder configure (springApplicationBuilder Application) {return application.sources (applact.class); } public static void main (String [] args) {springApplication.run (application.class, args); }}@enableadminserver 모니터링을 시작하기 위해이 주석을 추가하십시오
5. SecurityConfig
@profile ( "secure") @configuration public class securityconfig는 websecurityconfigureradapter {@override protected void configure (httpsecurity http)를 예외 {http.formlogin (). loginpage ( "/login.html"). loginprocessurl ( "/loginal ("/loginprocessing ( "/loginprocess)"). http.logout (). logouturl ( "/logout"); http.csrf (). disable (); http.authorizerequests () .antmatchers ( "/login.html", "/**/*.css", "/img/**", "/third-party/**"). permitall (); http.authorizerequests (). Antmatchers ( "/api/**"). permitall (). antmatchers ( "/**") .authenticated (); // 클라이언트가 http.httpbasic () 등록을 위해 http Basic을 통해 인증 할 수 있도록 활성화합니다. }}스프링 보안을 사용하여 기본 보안 정책을 구성하십시오
6. 감독 및 관리
1 ~ 5 단계가 구성된 후에는 응용 프로그램을 사용하여 모니터링 프로그램을 시작하십시오.
http://www.test.com:8080/login.html 모니터링 로그인 인터페이스를 통해 보안 확인 후 : 아래 그림과 같이.
특정 프로젝트 모니터링 정보 (세부 사항, 로그, 메트릭, 환경, 로깅, JMX, 스레드, 감사, 추적, HeapDump)를 확인하려면 세부 정보를 입력하십시오.
요약
위의 것은 Spring Boot에서 귀하에게 소개 된 관리자 모니터링을 추가하는 방법입니다. 나는 그것이 당신에게 도움이되기를 바랍니다. 궁금한 점이 있으면 메시지를 남겨 주시면 편집자가 제 시간에 답장을 드리겠습니다. Wulin.com 웹 사이트를 지원해 주셔서 대단히 감사합니다!