hystrix-dashboard仪表盘报错:Unable to connect to Command Metric Stream.

最近学习springcloud hystrix组件,启用 HystrixDashboard,输入

https://localhost:80/actuator/hystrix.stream

后报错:Unable to connect to Command Metric Stream.

配置文件加上如下配置

management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream
      base-path: /actuator/

或者主启动类上加上如下代码后还是不行,

@Bean
	public ServletRegistrationBean getServlet() {
		HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
		ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
		registrationBean.setLoadOnStartup(1);
		registrationBean.addUrlMappings("/actuator/hystrix.stream");
		registrationBean.setName("HystrixMetricsStreamServlet");
		return registrationBean;
	}

原来需要以http请求方式,而不是https请求方式访问,输入http://localhost:80/actuator/hystrix.stream 后终于可以正常访问了。

你可能感兴趣的:(SpringCloud)