欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

關(guān)于Spring?Cloud的熔斷器監(jiān)控問題

 更新時間:2022年01月23日 14:22:42   作者:程序貓大剛  
Turbine是一個聚合Hystrix監(jiān)控數(shù)據(jù)的工具,它可將所有相關(guān)/hystrix.stream端點的數(shù)據(jù)聚合到一個組合的/turbine.stream中,從而讓集群的監(jiān)控更加方便,接下來通過本文給大家介紹Spring?Cloud的熔斷器監(jiān)控,感興趣的朋友一起看看吧

Hystrix監(jiān)控

actuator的監(jiān)控節(jié)點

actuator下有用來監(jiān)控hystrix的端點/actuator/hystrix.stream。

訪問:

http://localhost:9202/actuator/hystrix.stream

輸出:(注意監(jiān)控時需要請求@HystrixCommand配置的微服務(wù))

ping: 

data: {"type":"HystrixCommand","name":"feignCardRand","group":"TestController","currentTime":1641272819332,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":1000,"rollingCountBadRequests":0,"rollingCountCollapsedRequests":0,"rollingCountEmit":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackEmit":0,"rollingCountFallbackFailure":0,"rollingCountFallbackMissing":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":1000,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"rollingMaxConcurrentExecutionCount":10,"latencyExecute_mean":0,"latencyExecute":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"latencyTotal_mean":0,"latencyTotal":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"THREAD","propertyValue_executionIsolationThreadTimeoutInMilliseconds":1000,"propertyValue_executionTimeoutInMilliseconds":1000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1,"threadPool":"TestController"}

集成hystrix dashboard

接口數(shù)據(jù)查看起來不直觀,可以運行hystrix dashboard通過界面來查看。

先引入依賴

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>

創(chuàng)建啟動類

@EnableHystrixDashboard
@SpringBootApplication(scanBasePackages = "com.github.mg0324")
public class StartupApplication {
    public static void main(String[] args) {
        SpringApplication.run(StartupApplication.class,args);
    }
}

添加首頁跳轉(zhuǎn),支持端口直接到hystrix資源路徑

@Controller
public class HystrixIndexController {
  @GetMapping("")
  public String index() {
    return "forward:/hystrix";
  }
}

添加配置端口

server:
  port: 8030

hystrix:
  dashboard:
    # 設(shè)置允許連接的IP
    proxy-stream-allow-list: "192.168.3.29"

啟動服務(wù),并訪問 http://127.0.0.0:8030

監(jiān)控詳情解讀

在 Hystrix Dashboard 界面里的url處填寫要監(jiān)控的hystrix數(shù)據(jù)流地址。
如:http://192.168.3.29:9202/actuator/hystrix.stream

如果連接后的界面里什么都沒有顯示,則需要手動請求后,才能展現(xiàn)數(shù)據(jù)。可以用 ab 命令做請求壓測,加大壓力,讓熔斷器開啟,圖中會出現(xiàn)紅色。

ab命令如下:
ab -n 10000 -c 160 http://127.0.0.1:9201/test/test/feign/cardRand

集成Turbine監(jiān)控

Turbine是一個聚合Hystrix監(jiān)控數(shù)據(jù)的工具,它可將所有相關(guān)/hystrix.stream端點的數(shù)據(jù)聚合到一個組合的/turbine.stream中,從而讓集群的監(jiān)控更加方便。

添加依賴。

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency>

編寫啟動類。

@EnableTurbine
@SpringBootApplication(scanBasePackages = "com.github.mg0324")
public class StartupApplication {
    public static void main(String[] args) {
        SpringApplication.run(StartupApplication.class,args);
    }
}

添加配置。

server:
  port: 8031
spring:
  application:
    name: card-hystrix-turbine
eureka:
  client:
    service-url:
      defaultZone: http://192.168.3.29:8761/eureka/
  instance:
    prefer-ip-address: true
turbine:
  # 要監(jiān)控的微服務(wù)列表,多個用,分隔
  appConfig: mic-card,mic-test
  clusterNameExpression: "'default'"

啟動服務(wù)后,得到 http://192.168.3.29:8031/turbine.stream 的聚合節(jié)點。填寫到hystrix dashboard的url中做監(jiān)控。

參考

https://www.itmuch.com/spring-cloud/finchley-15/

到此這篇關(guān)于Spring Cloud的熔斷器監(jiān)控的文章就介紹到這了,更多相關(guān)Spring Cloud 熔斷器內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Spring Boot如何使用Spring Security進行安全控制

    Spring Boot如何使用Spring Security進行安全控制

    要實現(xiàn)訪問控制的方法多種多樣,可以通過Aop、攔截器實現(xiàn),也可以通過框架實現(xiàn),本文將具體介紹在Spring Boot中如何使用Spring Security進行安全控制。
    2017-04-04
  • Java進階必備之多線程編程

    Java進階必備之多線程編程

    今天帶大家來學(xué)習java多線程編程,文中有非常詳細的代碼示例及介紹,對正在學(xué)習java多線程的小伙伴們很有幫助,需要的朋友可以參考下
    2021-05-05
  • 基于Log4j2阻塞業(yè)務(wù)線程引發(fā)的思考

    基于Log4j2阻塞業(yè)務(wù)線程引發(fā)的思考

    這篇文章主要介紹了基于Log4j2阻塞業(yè)務(wù)線程引發(fā)的思考,基于很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-12-12
  • Kafka Java Producer代碼實例詳解

    Kafka Java Producer代碼實例詳解

    這篇文章主要介紹了Kafka Java Producer代碼實例詳解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友可以參考下
    2020-06-06
  • java日期相關(guān)類實例詳解

    java日期相關(guān)類實例詳解

    這篇文章主要介紹了java日期相關(guān)類實例詳解,小編覺得還是挺不錯的,這里分享給大家,供需要的朋友參考。
    2017-10-10
  • SVN 安裝教程之服務(wù)器和客戶端

    SVN 安裝教程之服務(wù)器和客戶端

    這篇文章主要介紹了SVN 安裝教程之服務(wù)器和客戶端的相關(guān)資料,這里對安裝步驟進行了詳細介紹,需要的朋友可以參考下
    2016-11-11
  • SpringBoot項目啟動時如何讀取配置以及初始化資源

    SpringBoot項目啟動時如何讀取配置以及初始化資源

    這篇文章主要給大家介紹了關(guān)于SpringBoot項目啟動時如何讀取配置以及初始化資源的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者使用SpringBoot具有一定的參考學(xué)習價值,需要的朋友們下面來一起學(xué)習學(xué)習吧
    2020-06-06
  • java使用Filter實現(xiàn)自動登錄的方法

    java使用Filter實現(xiàn)自動登錄的方法

    這篇文章主要為大家詳細介紹了java使用Filter實現(xiàn)自動登錄的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • Java常用工具類匯總 附示例代碼

    Java常用工具類匯總 附示例代碼

    這篇文章主要介紹了Java常用工具類,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友們下面隨著我來一起學(xué)習學(xué)習吧,希望能給你帶來幫助
    2021-06-06
  • java 保留兩位小數(shù)的幾種方法

    java 保留兩位小數(shù)的幾種方法

    這篇文章主要介紹了JAVA中小數(shù)點后保留兩位的幾種方法,并有小實例,希望能幫助有所需要的同學(xué)
    2016-07-07

最新評論