首页 > 解决方案 > 如何解决“无法连接到命令度量流”。对于带有 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

尤里卡

HYSTRIX

附加信息:

  1. 我添加spring-boot-starter-actuator到网关服务的 pom.xml 中。我还添加了spring-cloud-starter-circuitbreaker-reactor-resilience4j.
  2. IntelliJ IDEA 标记proxy-stream-allow-listtimeoutInMilliseconds无法解析配置属性”
  3. 这些链接没有帮助:无法连接到 hystrix 仪表板中的命令度量流无法使用 Spring Cloud连接到 Hystrix 仪表板的命令度量流,Hystrix:无法连接到命令度量流Spring Boot 中的 Hystrix 仪表板问题无法连接到命令度量流。在 Hystrix Dashboard 问题中。

更新 1: 未解决的依赖

更新 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);
    }

}

标签: javaspringspring-bootspring-cloudhystrix

解决方案


推荐阅读