SpringCloud IDEA 教学 (五) 断路器控制台(HystrixDashboard)

写在开头

 断路器控制台是为了查看断路器运行情况而研发的。本章介绍了断路器控制台的搭建,代码基于之前Client的搭建。HystrixDashboard基于之前配置好的,使用了HystrixCommand注解的接口

 正文开始

首次建立项目的用户需要用IDEA额外增加下面Maven依赖,具体方法参见第一章

继续上文搭建项目的用户,pom增加

     <!--监控配置-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <!--断路器仪表盘插件-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        </dependency>

另外,需配置

Application增加@EnableHystrixDashboard

@SpringBootApplication
@EnableDiscoveryClient
@Configuration
@EnableHystrix
@EnableHystrixDashboard
public class ClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(ClientApplication.class, args);
    }

    @Bean
    @LoadBalanced
    RestTemplate getRestTemplate() {
        return new RestTemplate();
    }

}

yml配置文件增加

management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream

启用服务中心、S端、C端

登陆http://localhost:8003/hystrix

 

输入http://localhost:8003/actuator/hystrix.stream 后点击Monitor Stream,查看接口监控页面

 

 

写在最后

Enjoy it~ 

 

以上,亲测。

欢迎在评论区指正,

如果感觉本教程对您有所帮助,希望可以为笔者打Call

 

转载于:https://www.cnblogs.com/tianmh/p/9202431.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值