配置 启动 Hystrix Dashboard 报错???

Proxy opening connection to: http://localhost:4444/hystrix?delay=2000
404!!!
配置 启动 Hystrix Dashboard 报错???_第1张图片配置 启动 Hystrix Dashboard 报错???_第2张图片

经一番百度得知:需在应用程序启动类注入HystrixMetricsStreamServlet

@Bean
    public ServletRegistrationBean getServlet(){

        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();

        ServletRegistrationBean regBean = new ServletRegistrationBean(streamServlet);

        regBean.setLoadOnStartup(1);

        List mappingList = new ArrayList();

        mappingList.add("/hystrix.stream");

        regBean.setUrlMappings(mappingList);

        regBean.setName("hystrixServlet");

        return regBean;

    }

如此再重新启动 hystrix,刚开始访问会一直 Load …. 也一直在ping,此时需要
配置 启动 Hystrix Dashboard 报错???_第3张图片
再刷新一下 localhost:4444/hello
再刷新一下localhost:4444/hystrix.stream就会出现仪表盘了:
配置 启动 Hystrix Dashboard 报错???_第4张图片
+++++++++++++++++++++++++++++++++++++++++++

原因

  • springboot 2.0 出现Unable to connect to Command Metric Stream.1.5不会
  • 如果使用springboot2.0 和spring cloud Finchley.M8 版本搭建 使用(/actuator/hystrix.stream 而不是/hystrix.stream 为插入点)

(但是我自己测试还是不行,必须注入HystrixMetricsStreamServlet
)可参考这篇文章:https://blog.csdn.net/ddxd0406/article/details/79643059

你可能感兴趣的:(SpringCloud)