gpt4 book ai didi

spring - 无法使用 Spring Cloud 连接到 Hystrix Dashboard 的 Command Metric Stream

转载 作者:行者123 更新时间:2023-12-02 09:30:28 25 4
gpt4 key购买 nike

我有一个带有 Spring Cloud 的微服务项目,来自父级的代码片段:

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR3</version>
<type>pom</type>
<scope>import</scope>
</dependency>

所有服务都运行在Eureka服务器下:

enter image description here

所有服务都运行良好。我可以与 postman 进行适当的通话,一切正常。

我有单独的服务来处理 Hystrix 仪表板,来自 pom 的片段:

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>

配置主类:

@SpringBootApplication
@EnableHystrixDashboard
public class DashboardApp {
public static void main(String[] args) {
SpringApplication.run(DashboardApp.class, args);
}
}

和配置yaml文件:

spring:
application:
name: Dashboard

server:
port: 8000

eureka:
client:
fetchRegistry: true
registerWithEureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka

我正在寻找下一个仪表板:

enter image description here

来自控制台的完整堆栈跟踪是 here 。以下是一些片段:

2018-04-12 11:28:25.089 ERROR 15762 --- [qtp295055909-16] ashboardConfiguration$ProxyStreamServlet : Error proxying request: http://localhost:8082/hystrix.stream
java.lang.RuntimeException: org.eclipse.jetty.io.EofException
at org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration$ProxyStreamServlet.doGet(HystrixDashboardConfiguration.java:208)
....
Caused by: org.eclipse.jetty.io.EofException: null
...
Caused by: java.io.IOException: Broken pipe
...

服务本身可以通过 Spring 执行器访问:

enter image description here

来自它的pom的片段:

    <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

配置类看起来:

@EnableHystrix
@EnableEurekaClient
@SpringBootApplication
public class TableApp {
public static void main(String[] args) {
SpringApplication.run(TableApp.class, args);
}
}

如何解决这个问题?

最佳答案

对于使用 Spring Boot 2 的用户,hystrix.stream 端点已移至 /actuator/hystrix.stream

对我来说这个网址有效:

http://localhost:8082/actuator/hystrix.stream

是的,通过以下属性启用此执行器端点:

management.endpoints.web.exposure.include=hystrix.stream

当然,您的项目中必须包含执行器依赖项。

关于spring - 无法使用 Spring Cloud 连接到 Hystrix Dashboard 的 Command Metric Stream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49792290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com