继续上一篇,接下来Springcloud配置Hystrix Dashboard监控断路器。
1、添加依赖
在ribbon模块中
<!--Hystrix Dashboard--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <!--结合Hystrix Dashboard一同使用查看监控--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
2、启动类
添加下面注解
@EnableHystrixDashboard
3、调用接口
首先第一步访问:http://localhost:8075/hystrix/
第二步填写信息:http://localhost:8075/actuator/hystrix.stream
第三步访问接口:http://localhost:8075/ribbon/toLoadBalance
第四步访问接口:http://localhost:8075/actuator/hystrix.stream
第五步最后打开: Monitor Stream,如下
成功!