Spring Cloud Health Monitoring configuration

Source: Internet
Author: User

Configuration Instructions Note-Turn hump

中文版

http://cloud.spring.io/spring-cloud-static/Dalston.SR2/#spring-cloud-feign

China

Https://springcloud.cc/spring-cloud-dalston.html

Eureka Server Configuration server:

Server
port:8761
Eureka

Register-with-eureka:false
Fetch-registry:false
Server
Enable-self-preservation:false
#每指定时间 Refresh the list of services
eviction-interval-timer-in-ms:5000

Eureka Client

Server:  port:8080spring:  application:    name:my-health-providerendpoints:  Sensitive:falseeureka:  instance:    #每指定时间向发送 Eureka Server to send renewal information    leaserenewalintervalinseconds:5    #每指定时间没有向服务器发送续约信息, That is, send the down-machine information to the Eureka Server    leaseexpirationdurationinseconds:10    metadata-map:      company-name:crazyit       client:    #指示将实例信息复制到eureka服务器的开始时间 (in seconds)    #配合健康检测器, Health indicator notifies Eureka Server    of instance health status Instanceinforeplicationintervalseconds:10    serviceurl:      defaultzone:http://localhost:8761/eureka/

Health indicators

@Component  Public class Implements Healthindicator {    Public health Health  () {        if( POLICECONTROLLER.CANVISITDB) {            returnnew  Health.builder (status.up). Build () ;         Else {            returnnew  Health.builder (status.down). build ();     }}}

Health Monitors

@Component Public classMyhealthcheckhandlerImplementsHealthcheckhandler {@AutowiredPrivateMyhealthindicator Halthindicator;  Publicinstancestatus getStatus (instancestatus currentstatus) {Status Status=halthindicator.health (). GetStatus (); if(Status.equals (status.up)) {returnInstancestatus.up; } Else {            returnInstancestatus.down; }    }}

Spring Cloud Health Monitoring configuration

Related Article

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.