1. 程式人生 > >springcloud Finchley基於springboot2.0 開啟hystrix dashboard Unable to connect to Command Metric Stream

springcloud Finchley基於springboot2.0 開啟hystrix dashboard Unable to connect to Command Metric Stream

springcloud Finchley改動很大,很多配置的名稱,模組的名稱都變了,開啟hystrix dashboard頁也不一樣

springcloud Finchley 模組名稱變更檢視

pom.xml

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

bootstrap.properties 配置。開啟暴露介面

#/actuator/hystrix.stream
management.endpoints.web.exposure.include=*

啟動類main註解

@EnableCircuitBreaker
@EnableHystrixDashboard

訪問ip:port/contextPath/hystrix
輸入ip:port/contextPath/actuator/hystrix.stream 上下都顯示loading 就說明連線上了

訪問被@HystrixCommand註解的方法,就能看到統計