Loading

[hystrix] hystrix-dashboard 关于 Unable to connect to Command Metric Stream 的问题解决方法

问题

在hystrix-dashboard界面中出现以下错误

解决方法

  1. 高版本(具体哪些版本之后我不知道,加上去试试)springcloud需要加以下配置(在被监控一端):
@Configuration
public class HystrixConfig {
    @Bean
    public ServletRegistrationBean getServlet() {
        HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
        registrationBean.setLoadOnStartup(1);
        registrationBean.addUrlMappings("/hystrix.stream");
        registrationBean.setName("HystrixMetricsStreamServlet");
        return registrationBean;
    }
}
  1. 被监控端pom文件添加以下依赖:
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
  1. 在被监控端配置文件添加以下配置(开放以下actuator监控权限):
management:
  endpoints:
    web:
      exposure:
        include: ["health","info","hystrix.stream"]
  1. 在hashboard端配置文件添加以下配置(运行访问熔断监控页面的地址):
hystrix:
  dashboard:
    proxy-stream-allow-list: "localhost"
  1. 还不行就再google吧...然后解决了就在底下更新

Extra

hystrix hashboard 不需要 eureka

posted @ 2022-09-26 01:07  丘丘CRUD  阅读(96)  评论(0)    收藏  举报