首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在独立涡轮应用程序中激活/turbine.stream端点

如何在独立涡轮应用程序中激活/turbine.stream端点
EN

Stack Overflow用户
提问于 2018-08-28 14:47:53
回答 1查看 987关注 0票数 2

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

Spring :2.0.4,Spring : Finchley.SR1

申请课程:

代码语言:javascript
复制
@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
public class DemoApplication {

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

}

Applicaiton.yml的内容:

代码语言:javascript
复制
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依赖关系:

代码语言:javascript
复制
<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> 

我为此创建了一个样本工程

EN

回答 1

Stack Overflow用户

发布于 2018-09-06 08:29:23

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

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

代码语言:javascript
复制
http://localhost:{turbine app port}/turbine.stream?cluster={configured cluster in properties file}

url应该指向主类中包含@EnableTurbine注释的应用程序的端口。

2)检查是否收到了以下方面的答复:

代码语言:javascript
复制
http://localhost:{client app port}/actuator/hystrix.stream

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

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

代码语言:javascript
复制
management.endpoints.web.exposure.include= hystrix.stream, info, health

再检查一下URL。

3)从hystrix.stream获得响应后,现在可以在透平应用程序属性文件上配置集群:

代码语言:javascript
复制
turbine:

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

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

代码语言:javascript
复制
http://localhost:{turbine app port}/clusters

如果一切顺利的话,你就不应该在浏览器上得到一个"[]“。

一旦您看到集群端点上的响应,您现在就可以看到指示板上的详细信息,当您将其指向透平应用程序时。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52060679

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档