如何在独立的Turbine应用程序中激活/turbine.stream端点

问题描述 投票:1回答:1

我正在尝试创建一个独立的应用程序来从其他应用程序收集Hystrix流。但它默认不暴露/turbine.stream端点。我确信我的项目中缺少什么。

Spring Boot:2.0.4.RELEASE,Spring Cloud:Finchley.SR1

应用程序类:

@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
public class DemoApplication {

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

}

application.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> 

我为此创建了一个sample project

spring spring-boot spring-cloud spring-cloud-netflix
1个回答
2
投票

我建议你查看下面的配置步骤:

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的应用程序)

如果你得到ping,那么至少你的hystrix流是可访问的。如果没有,请检查您的客户端依赖项中是否有:org.springframework.boot:spring-boot-starter-actuator,并确保在主类中具有@EnableCircuitBreaker的应用程序的application.properties文件中设置了以下属性:

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

再次检查URL。

3)一旦您收到hystrix.stream的回复,您现在可以在Turb应用程序属性文件中配置您的群集:

turbine:

      appConfig: {serviceId in lower case}
      aggregator:
        clusterConfig: {above serviceId in upper case} 

运行应用程序后,检查您是否正确配置了群集:

http://localhost:{turbine app port}/clusters

如果一切顺利,你不应该在你的浏览器上获得“[]”。

在群集端点上看到响应后,您现在可以在将其指向涡轮机应用程序时查看仪表板上的详细信息

© www.soinside.com 2019 - 2024. All rights reserved.