如何解决“无法连接到命令指标流”对于带有 Spring Boot 2.3.12 和 Java 11 的 Hystrix?

问题描述

我正在使用 Spring Boot 2.3.12、Java 11 和 Spring Cloud Hoxton.SR11 制作应用程序。我添加了 Eureka 和 Hystrix 服务。当我调用 'http://localhost:8080/actuator/hystrix.stream' 时,我会收到像 data: {"type": "ping"} 这样的消息流。

但是当我将此路径插入“http://localhost:9195/hystrix/”时,我收到一条错误消息“无法连接到命令指标流”。和 WARN-log 'Origin 参数:http://localhost:8080/actuator/hystrix.stream 不在允许的代理主机名列表中。如果允许将其添加到 hystrix.dashboard.proxyStreamAllowList'

我将此添加到网关 properties.yaml:

management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream,info,health

hystrix:
  dashboard:
    proxy-stream-allow-list: "*"
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 10000

EUREKA

HYSTRIX

附加信息:

  1. 我在网关服务的 pom.xml 中添加spring-boot-starter-actuator。我还添加spring-cloud-starter-circuitbreaker-reactor-resilience4j
  2. IntelliJ IDEA 将 proxy-stream-allow-listtimeoutInMilliseconds 标记'无法解析配置属性'
  3. 这些链接没有帮助:Unable to connect to Command Metric Stream in hystrix dashboardUnable to connect to Command Metric Stream for Hystrix Dashboard with Spring CloudHystrix: Unable to connect to Command Metric StreamHystrix Dashboard Issue in Spring BootUnable to connect to Command Metric Stream. in Hystrix Dashboard issue

更新 1:

unresolved dependency

更新 2:

我使用 Hystrix Dashboard 作为单独的新 Java 模块。该模块包含 application.properties:

server.port=9195

和主类:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;

@SpringBootApplication
@EnableHystrixDashboard
public class HystrixDashboardApplication {

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

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)