我正在尝试创建一个独立的应用程序来收集来自其他应用程序的Hystrix流。但默认情况下,它不公开/turbine.stream端点。我确信我的项目中缺少的是什么。
Spring :2.0.4,Spring : Finchley.SR1
申请课程:
@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}Applicaiton.yml的内容:
server:
port: 8383
spring:
application:
name: hystrix-turbine
management:
endpoints:
web.exposure.include: '*'
applications: hystrix
turbine:
aggregator:
clusterConfig: ${applications}
appConfig: ${applications}
# instanceUrlSuffix.default: actuator/hystrix.stream和maven依赖关系:
<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.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> 我为此创建了一个样本工程。
发布于 2018-09-06 08:29:23
我建议您检查下面的配置步骤:
1) Hystrix仪表板中的流URL应该是:
http://localhost:{turbine app port}/turbine.stream?cluster={configured cluster in properties file}url应该指向主类中包含@EnableTurbine注释的应用程序的端口。
2)检查是否收到了以下方面的答复:
http://localhost:{client app port}/actuator/hystrix.stream(为此使用您的浏览器)(这应该来自您在使用@EnableCircuitBreaker时启用hystrix的应用程序)
如果您正在获得pings,那么至少您的hystrix流是可访问的。如果没有,请检查客户端依赖项中是否有:org.springframework.boot:spring-boot-starter-actuator,并确保在主类中有@EnableCircuitBreaker的应用程序的application.properties文件中设置了以下属性:
management.endpoints.web.exposure.include= hystrix.stream, info, health再检查一下URL。
3)从hystrix.stream获得响应后,现在可以在透平应用程序属性文件上配置集群:
turbine:
appConfig: {serviceId in lower case}
aggregator:
clusterConfig: {above serviceId in upper case} 运行该应用程序后,检查是否正确配置了集群:
http://localhost:{turbine app port}/clusters如果一切顺利的话,你就不应该在浏览器上得到一个"[]“。
一旦您看到集群端点上的响应,您现在就可以看到指示板上的详细信息,当您将其指向透平应用程序时。
https://stackoverflow.com/questions/52060679
复制相似问题