首页 > 其他 > 详细

05. Hystrix Dashboard

时间:2020-05-12 17:59:27      阅读:51      评论:0      收藏:0      [点我收藏+]

05. Hystrix Dashboard

  • 新建模块加入依赖

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

    无需添加其他任何依赖, 该依赖已经包括spring-boot-start-web

  • 修改yml

    server:
      port: 9001
    
    
  • 添加主启动类

    //开启hystrix dashboard
    @EnableHystrixDashboard
    @SpringBootApplication
    public class MicrosoftHystrixDashboard9001Application {
    	public static void main(String[] args) {
    		SpringApplication.run(MicrosoftHystrixDashboard9001Application.class, args);
    	}
    	
    }
    
  • 服务提供者yml

    management:
      endpoints: #通过http://localhost:8081/actuator/${endpoints}来访问
        web:
          exposure:  #暴露endpoints,默认对web暴露health和info
            include: "*"
    

    这里需要额外对web开启hystrix.stream endpoint

    或是指定include: "info,health,hystrix.stream"

  • 访问localhost:9001/hystrix

技术分享图片

? 出现页面表示成功

  • Delay表示多少时间检查一次

  • Title表示监视的服务提供者的名字, 可以自定义, 对应Hystrix Stream

  • 访问localhost:8081/actuator/hystrix.stream, hystrix-app是服务提供者的ip

  • 消费者发送一次请求

    出现如下页面表示成功

技术分享图片

技术分享图片

这里注意的是!!!

只会对有@EnableHystrix和@HystrixCommand注解的服务模块生效, 不会对api模块中配置的FabllbackFactory生效

05. Hystrix Dashboard

原文:https://www.cnblogs.com/kikochz/p/12877547.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!