我正在尝试使用Netflix eureka服务发现和hystrix断路器来构建简单的spring云应用程序。
断路器业务:
@EnableCircuitBreaker
@SpringBootApplication
@EnableEurekaClient
public class PluralsightEurekaFastpassConsoleApplication {
public static void main(String[] args) {
SpringApplication.run(PluralsightEurekaFastpassConsoleApplication.class, args);
}
}pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>
spring-cloud-starter-netflix-hystrix
</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>Hystrix仪表板
@EnableHystrixDashboard
@SpringBootApplication
@EnableDiscoveryClient
public class PluralsiteHystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(PluralsiteHystrixDashboardApplication.class, args);
}
}pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>hystrix仪表板

控制台日志
2018-07-04 20:15:25.051 INFO 17516 -- nio-8088-exec-1 ashboardConfiguration$ProxyStreamServlet :代理打开连接到:http://localhost:8088/actuator/hystrix.stream 2018-07-04 20:15:25.052 INFO 17516 - nio-8088-exec-6 ashboardConfiguration$ProxyStreamServlet:http://localhost:8088/actuator/hystrix.stream 2018-07-04 20:15:25.058警告17516 -- nio-8088-exec-1 ashboardConfiguration:与http://localhost:8088/actuator/hystrix.stream的打开连接失败: 404 : HTTP/1.1 4042018-07-04 20:15:25.058警告17516 -- nio-8088-exec-6 -配置$ProxyStreamServlet:打开到http://localhost:8088/actuator/hystrix.stream的连接失败: 404 :HTTP/1.1404
我试过Unable to connect to Command Metric Stream for Hystrix Dashboard with Spring Cloud
但问题仍然存在。
发布于 2018-07-04 19:16:50
问题没有提供足够的信息,所以最好的办法可能是确保:
actuator上下文路径下部署和访问。为了检查执行器的实际位置,分析启动日志,如果没有部署端点的信息,将--debug添加到微服务的应用程序启动中。看来第二步将揭示真正的问题。然后可以使用management.context-path设置执行器上下文路径,或者应该定制hystix仪表板。
https://stackoverflow.com/questions/51177728
复制相似问题