Spring Boot Admin Practice

Source: Internet
Author: User
Tags http post
Spring boot Admin is used to monitor spring boot-based applications, including server and client. The Client "registers" its information with the server and then sees the status information of the "registered" Spring Boot app on the server.
"No introduction of Spring-cloud" 1. Server side 1) introduced in Pom.xml
<dependency>
   <groupId>de.codecentric</groupId>
   <  Artifactid>spring-boot-admin-server</artifactid>
</dependency>
<dependency>
   <groupId>de.codecentric</groupId>
   <artifactid>spring-boot-admin-server-ui</artifactid>
</  Dependency>
2) Main class open monitoring: @EnableAdminServer, @Configuration, @EnableAutoConfiguration
2. Client side 1) introduced in Pom.xml
<dependency>
   <groupId>de.codecentric</groupId>
   <  Artifactid>spring-boot-admin-starter-client</artifactid>
</dependency >
2) Specify the server registration address in the properties configuration file, such as Spring.boot.admin.url= http://localhost:8080 Note:After the client has registered, the default is to display only detail,trace,heapdump, if you need to see metrics,enviroment,threads,jmx,logging, you need to introduce Spring-boot-starter-actuator, and configure Endpoints.sensitive:false
3. Server side monitoring itself if the server needs to monitor itself, the server side also as a Client to configure the same can be achieved: reference 2nd
"Introducing Spring-cloud" when spring boot admin is registered with Eureka server, you can manage all applications registered to Eureka server, including Spring boot admin yourself (because you will also be registered to Eu Reka Server) 1. Server side 1) introduced in Pom.xml
<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactid>spring-cloud-starter-eureka</artifactid>
</  Dependency>
<dependency>
   <groupId>de.codecentric</groupId>
   < artifactid>spring-boot-admin-server</artifactid>
</dependency >
<dependency>
   <groupId>de.codecentric</groupId >
   <artifactid>spring-boot-admin-server-ui</artifactid>
</Dependency>
2) Main class open monitoring: @EnableEurekaClient, @EnableAdminServer 3) Configure Eureka.instance.client.serviceUrl.defaultZone in the properties
2. Client side only need to register to Eureka Server, do not need to do other configuration, if configured with Spring.boot.admin.url, then the Monitoring home page will show 2 duplicate client side. 1) The client wants to add spring-boot-starter-actuator dependencies, because obtaining application information is obtained through the relevant endpoints in actuator. 2) Jmx-bean Management and Loglevel management reference below
"Dynamically modify environment variable value" 1. Open the server-side URL, such as HTTP://LOCALHOST:60003/2. In Environment Manager, you can specify Property-name, modify Property-value, and then update environment. You can modify more than 3. The modified values are displayed in Propertysource Manager and also in the/ENV endpoint. The values in the @configurationproperties-bound class are updated. This action can be used to dynamically update business configuration 4. Click Reset Environment, and all the values you modified will be restored. The value in the @ConfigurationProperties-bound class is also restored 5. After the process restarts, all environment variable values are initialized by the value of
"Spring Boot Admin Server Configuration description" Spring.boot.admin.context-path Admin server retains the prefix of static access and APIs (when you use it in a business app instead of using it alone) Spring.boot.admin.monitor.period default 10.000, update the frequency of application information, per millisecond spring.boot.admin.monitor.status-lifetime default 10.000 The expiration time of the monitored application information, in milliseconds
Spring Boot Admin Client configuration Instructions Spring Boot admin client registers to spring boot admin server,client periodically sends Http Post to admin to provide their own Application information. If you need to manage loglevels or Jmx-beans, add Jolokia to the dependency so that Jmx-beans can also be accessed over HTTP. Spring.boot.admin.client.enabled default true opens the address list for Spring.boot.admin.url Admin server by default, this setting triggers automatic configuration and must be Spring.boot.admin.api-path registered to the admin server endpoint Http-path spring.boot.admin.username registered to the Admin server's account Spring.boot.adm In.password registration to Admin server password spring.boot.admin.period default 10.000 retry registration interval spring.boot.admin.auto-registration default True Automatically perform recurring registration tasks after the app starts spring.boot.admin.auto-deregistration default False when the app is closed, automatically unregister Spring.boot.admin.client.health-url Spring.boot.admin.client.management-url Spring.boot.admin.client.service-url Spring.boot.admin.client.name when registering the name Spring.boot.admin.client.prefer-ip Default False
"Other Configuration" 1. The content displayed in info in spring boot admin needs to be configured with info in the server or client, such as: #Info配置 Info.aaa.description:Eureka info.aaa.url:https:// Github.com/jixuju/spring-cloud-test INFO.AAA.BUILD-BY:SUPERWIND20 2. The Hystrix information shown in turbine in spring boot admin needs to be configured in the server turbine such as: #turbine配置 spring.boot.admin.turbine.url:http:// Localhost:60002/turbine.stream Spring.boot.admin.turbine.clusters:provider-service,ribbon-service,feign-service 3. Jmx-bean Management (if you need to manage JMX, configure it) Jmx-bean management requires the use of a third-party Jolokia, because spring-boot-admin-starter-client automatically relies on Jolokia-core, So there is no need to show dependencies, the following configuration based on Eureka registration discovery, because there is no configuration spring-boot-admin-starter-client, you need to display the ground dependency: Pom.xml <dependency> < Groupid>org.jolokia</groupid> <artifactId>jolokia-core</artifactId> </dependency> 4. Loglevel management (to be configured if you need to manage logging logs) Current log level management is limited to logback and is implemented via JMX, so you need to rely on Jolokia. Also, you need to configure Logback JMXConfigurator:logback.xml <configuration> <include resource= "org/springframework/boot/ Logging/logback/base.xml "/> <jmxconfiGurator/> </configuration> This logback.xml is placed in the same directory as application.properties, if you do not configure Logback, then the Spring Boot Admin will not be able to manage the log level of the app.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.