【问题标题】:Spring Boot TurbineSpring Boot 涡轮机
【发布时间】:2019-01-07 23:23:47
【问题描述】:


我用 Spring boot 2 尝试了涡轮 + hystrix 仪表板。但我遇到了问题,涡轮仪表板只显示:
正在加载 ...
我有工作的 Eureka 服务器和应用程序(发送正确的 hystrix.stream)
当我查看turtle.stream 时,它是唯一的

: ping
data: {"reportingHostsLast10Seconds":0,"name":"meta","type":"meta","timestamp":1533038381277}

我正在寻找很多问题,但我无法得到答案。

这是涡轮 pom 文件:

<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>com.netflix.archaius</groupId>
        <artifactId>archaius-core</artifactId>
        <version>0.7.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-netflix-turbine</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
        <version>2.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
        <version>2.0.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

application.properties

server.port=9090
spring.application.name=turbine-dashboard
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
turbine.app-config=RANDOMNUMBERSERVICE

应用程序

@SpringBootApplication
@EnableDiscoveryClient
@EnableTurbine
@EnableHystrixDashboard
public class TurbineTestApplication {

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

【问题讨论】:

    标签: turbine


    【解决方案1】:

    @janusz 请附上仪表板的屏幕截图以更清晰。

    如果您在屏幕上看到此内容:

    这可能意味着:

    • 您需要点击包含 @HystrixCommand 注释函数的端点(在您的情况下,我假设它是 RANDOMNUMBERSERVICE 应用程序的端点),以便为仪表板创建数据以显示。
    • 您没有正在运行的 serviceId RANDOMNUMBERSERVICE 实例
    • 检查您的集群是否配置正确:http://localhost:9090/clusters 不应在您的浏览器上返回 []

    如果您在屏幕上看到此内容:

    • 检查您的集群是否配置正确:http://localhost:9090/clusters 不应在您的浏览器上返回 []。通常,此问题是由于无法从配置的实例访问 /hystrix.steam,但您已声明您已收到流。

    我建议在您的 application.properties 文件中使用以下内容可以解决此问题:

    turbine.appConfig = randomnumberservice
    turbine.aggregator.clusterConfig = RANDOMNUMBERSERVICE
    

    最后,确保您为启用涡轮机的仪表板输入的 URL 指向您的仪表板所在的端口。 在你的情况下应该是:

    http://localhost:9090/turbine.stream?cluster=yourclustername

    【讨论】:

      猜你喜欢
      • 2019-03-26
      • 2011-03-22
      • 2011-01-25
      • 2015-10-22
      • 2017-07-11
      • 2012-11-16
      • 1970-01-01
      • 1970-01-01
      • 2010-11-10
      相关资源
      最近更新 更多