Use Springboot admin to monitor Springcloud Micro Services

Source: Internet
Author: User

This article adds configuration information based on the Springcloud environment and configuration, rather than the configuration that starts at 0.

First, build admin service side

1. Introduction of POM

<Properties>    <spring-boot-admin-starter-client.version>1.5.6</spring-boot-admin-starter-client.version>    <spring-boot-admin-serve.version>1.5.7</spring-boot-admin-serve.version>    <spring-boot-admin-serve-ui.version>1.5.7</spring-boot-admin-serve-ui.version></Properties><Dependencies>    <!--Add Admin server and UI support -    <Dependency>        <groupId>De.codecentric</groupId>        <Artifactid>Spring-boot-admin-server</Artifactid>        <version>${spring-boot-admin-serve.version}</version>    </Dependency>    <Dependency>        <groupId>De.codecentric</groupId>        <Artifactid>Spring-boot-admin-server-ui</Artifactid>        <version>${spring-boot-admin-serve-ui.version}</version>    </Dependency>    <!--increased UI support for Hystrix, requiring services to rely on Hystrix -    <Dependency>        <groupId>De.codecentric</groupId>        <Artifactid>Spring-boot-admin-server-ui-hystrix</Artifactid>        <version>1.5.7</version>    </Dependency>    <!--increased integration support for turbine, specifying relevant turbine parameter information -    <Dependency>        <groupId>De.codecentric</groupId>        <Artifactid>Spring-boot-admin-server-ui-turbine</Artifactid>        <version>1.5.4</version>    </Dependency></Dependencies>

2, Application.properties

#App Name # This variable must be written here, because the log file needs to be logged when the project starts, and if written on git, it causes the Bootstrap.log and Springappname_is_undefined.log to be generated .spring.application.name=crm-admin-Server#Service Portserver.port=21500Spring. profiles.active=Local#non-local startup, the registry is passed in with a startup parameter, and local testing is injected into the startup parameterseureka.client.serviceurl.defaultzone=http://127.0.0.1:20000/eureka/Eureka. instance.lease-renewal-interval-in-seconds=2Eureka. instance.lease-expiration-duration-in-seconds=6Eureka. instance.preferipaddress=Trueeureka. client.registryfetchintervalseconds=2#Disabling authentication for administrationManagement.security.enabled=false#Open ShutdownEndpoints.shutdown. enabled=true#Disable authentication of shutdownEndpoints.shutdown. sensitive=false#Turn on restart supportEndpoints.restart.enabled=true#Admin-managed endpoints (actuator)Spring.boot.admin.routes.endpoints=env,metrics,Dump, Jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,loggers,auditevents,hystrix.Stream#Turbine Service IDSpring.boot.admin.turbine.location=crm-turbine

3. Main method

Importorg.springframework.boot.SpringApplication;Importorg.springframework.boot.autoconfigure.SpringBootApplication;Importorg.springframework.cloud.client.discovery.EnableDiscoveryClient;Importde.codecentric.boot.admin.config.enableadminserver;@ Springbootapplication@enablediscoveryclient@enableadminserver Public classcrmadminserverapplication { Public Static voidMain (string[] args) {Springapplication.run (crmadminserverapplication.class, args); }}

Second, admin client

1. Reference Pom

For Springcloud projects, the default dependency is actuator, as long as you add the following dependencies

< Dependency >      < groupId >org.jolokia</groupId>      <Artifactid >jolokia-core</artifactid></Dependency  >

Of course, the simple solution is to quote spring-boot-admin-starter-client directly.

< Dependency >    < groupId >de.codecentric</groupId>    <Artifactid  >spring-boot-admin-starter-client</artifactid>  </dependency>

2, Application.properties

# Disable Actuator Management end authentication management.security.enabled=false#  enable shutdown   host:port/ ShutdownEndpoints. shutdown. enabled=true#  Disables password Authentication endpoints. shutdown. sensitive=false#  turn on restart support endpoints.restart.enabled=True  #  admin's Log tab with Logging.file=/data/logs/crm/${spring.application.name}. Log

3. Increased support for JMX in Logback-spring.xml

< Configuration >    <  resource= "Org/springframework/boot/logging/logback/defaults.xml"/>        < Jmxconfigurator />

The advantage of this is that you can dynamically change some of the log levels in the Admin UI interface.

Third, access the spring Boot Admin UI Interface

Use Springboot admin to monitor Springcloud Micro Services

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.