如何在独立的 Turbine 应用程序中激活/turbine.stream 端点 [英] How to activate /turbine.stream endpoint in a standalone Turbine application

查看:19
本文介绍了如何在独立的 Turbine 应用程序中激活/turbine.stream 端点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个独立的应用程序来从其他应用程序收集 Hystrix 流.但默认情况下它不会公开 /turbine.stream 端点.我确定我的项目中缺少什么.

I am trying to create a standalone application to collect Hystrix stream from other applications. But it does not expose the /turbine.stream endpoint by default. I am sure what is missing in my project.

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

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

}

applicaiton.yml 的内容:

The content of 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 依赖项:

And the maven dependencies:

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

我为此创建了一个示例项目.

推荐答案

我建议您检查以下配置步骤:

I'd suggest you check the configuration steps below:

1) 您在 Hystrix 仪表板中的流 URL 应该是:

1) Your stream URL in the Hystrix Dashboard should be:

http://localhost:{turbine app port}/turbine.stream?cluster={configured cluster in properties file}

该 url 应指向主类中具有 @EnableTurbine 注释的应用程序的端口.

The url should be pointing to the port of the application that has @EnableTurbine annotation in your main class.

2) 检查您是否收到以下回复:

2) Check if you are getting a response for:

http://localhost:{client app port}/actuator/hystrix.stream

(使用您的浏览器)(这应该来自您使用 @EnableCircuitBreaker 启用 hystrix 的应用程序)

(use your browser for this) (this should be coming from the application you have enabled hystrix on using @EnableCircuitBreaker)

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

If you're getting pings, then atleast your hystrix stream is accessible. If not, Check if you have: org.springframework.boot:spring-boot-starter-actuator in your client side dependencies and make sure you have the below property set in application.properties file of the application that has @EnableCircuitBreaker in the main class:

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

再次检查网址.

3) 从 hystrix.stream 得到响应后,您现在可以在涡轮机应用程序属性文件上配置集群:

3) Once your get a reponse from hystrix.stream, you can now configure your cluster on the turbine app properties file:

turbine:

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

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

after running the app, check if you've configured the cluster correctly:

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

如果一切顺利,您的浏览器不应出现[]".

you should'nt be getting a "[]" on your browser if all's well.

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

Once you see a response on the clusters endpoint, you will now be able to see the details on the dashboard when you point it to the turbine app

这篇关于如何在独立的 Turbine 应用程序中激活/turbine.stream 端点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆