Article Directory
- Actuator Step 1 using the checking and monitoring
- 1.1 Add coordinates Actuator in the pom file
- 1.2 In the global configuration file settings to turn off security restrictions
- 2 Use visual monitoring reports Spring Boot Admin
Actuator Step 1 using the checking and monitoring
1.1 Add coordinates Actuator in the pom file
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.6.RELEASE</version>
</dependency>
1.2 In the global configuration file settings to turn off security restrictions
# 在1.5.x版本中通过management.security.enabled=false来暴露所有端点
management.security.enabled=false
# 在2.x 的springboot中的properties文件格式
management.endpoints.web.exposure.include=*
# 在2.x的springboot版本中的yml格式
# 2.0 yml格式
management:
endpoints:
web:
exposure:
include: refresh
But spring boot2.0
later actuator
in security
the error A global security auto-configuration is now provided
, obsolescence problems, mainly:
- The reason given: In
spring boot2.0
a future release,actuator
ofsecurity
certain methods has expired, there has been change, but if you do not mind to continue to use it all right (.eclispe
Will not prompt, butidea
you will be prompted)
springboot
After a successful start, directly 127.0.0.1:8080/+以下请求URI
to
ID | description | The need for authentication |
---|---|---|
actuator | Provide a "discovery page" as the other endpoint. Requirements Spring HATEOAS in classpath the path |
need |
auditevents | Display the current audit events in the application of information | need |
autoconfig | Display configuration information and automatically displays all automatically configures the candidates and why they "are not" applied | need |
beans | For a complete list of all the applications show a Spring bean | need |
configprops | Display all configuration information | need |
dump | dump all thread | need |
env | Display all environment variables | need |
flyway | Shows any Flyway database migrations that have been applied | need |
health | Display application health information | Do not need |
info | Display information | Do not need |
loggers | loggers configure the display and modification application | need |
liquibase | Liquibase already display any database application migration | need |
metrics | Displays the current "index" Application of information | need |
mappings | Show all @RequestMapping the url finishing list. | need |
shutdown | Close the application (not enabled by default) | need |
trace | View tracking information (default to the last HTTP request 100) | need |
2 Use visual monitoring reports Spring Boot Admin
2.1 build server
2.1.1 coordinate the introduction admin
The server is actually a SpringBoot
project, the introduction of coordinates admin
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>1.5.7</version>
</dependency>
2.1.2 modify the startup class, adding @EnableAdminServer
@SpringBootApplication
@EnableAdminServer
public class SpringbootServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootServerApplication.class,args);
}
}
2.2 build client
In fact, 客户端
what we need to monitor the project.
2.2.1 modify the client's file to add dependencies pom
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<!-- 此处的版本号和springboot版本号一致,或者比springboot版本更低也可以 -->
<version>RELEASE</version>
</dependency>
2.2.2 modify the client's profile application.properteis
2.2.2.1 turn off security restrictions
# 当springboot是1.5.x时使用这个关闭安全限制如下
management.security.enabled=false
# 当springboot是2.X时,就使用如下
management.endpoints.web.exposure.include=*
# 当springboot是2.X时,使用的yml格式:
management:
endpoints:
web:
exposure:
# 此处的星号是特殊字符,必须用引号引起来
include: “*”
2.2.2.2 registration services to springbootadmin
# http://localhost:9090 表示是 Spring Boot Admin 服务单的 IP 地址以及端口号
spring.boot.admin.client.url=http://localhost:9090
2.2.2.3 let springboot admin ip access by host name
# 必须在客户端配置 boot.admin.client.instance.service-url属性,
# 让Spring Boot Admin服务端可以通过网络获取客户端的数据(否则默认会通过主机名去获取)
spring.boot.admin.client.instance.service-url=127.0.0.1:9090
# prefer-ip是否使用注册的ip地址来取代上述各个url中hostname的值,默认值是false
spring.boot.admin.client.instance.prefer-ip=true
2.3 monitoring information to explain
Error message:
Calling [asyncError()] is not valid for a request with Async state [MUST_DISPATCH]
This is no effect, saying that the built-in tomcat
problems, the spring-boot-admin-starter
next lower version, 2.1.2和2.1.3
may not make application
the page refresh out, this time to reduce 2.1.0
it