Turbine 仪表板未加载 Spring Cloud 微服务中的聚合

2024-04-18

我正在尝试使用 Spring MVC 和 Spring Boot 框架开发 Spring Cloud 微服务。以及用于 Spring Cloud 的 Eureka 服务器、Zuul、Ribbon、hystrix 和 Turbine。我已经开发了一个微服务并且只实现了 hystrix 仪表板。我能够使用 hystrix 仪表板。现在我正在实施更多服务。所以我选择了turbo来进行监控聚合。但它没有得到仪表板。我在单独的 Spring Boot 项目中实现了涡轮机。

我的 pom.xml 包含,

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>

我的主课包含,

@SpringBootApplication
@EnableHystrixDashboard
@EnableCircuitBreaker
@EnableTurbine

public class ZTurbineClientApplication {

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

我的涡轮机项目 application.properties 文件包含,

server.port=8085
spring.application.name=espace-Turbine
eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
turbine:
 aggregator:
  clusterConfig: APPCLUSTER
 app-config: espaceService1,espaceService2
 instanceUrlSuffix.APPCLUSTER: /hystrix.stream

我之前的第一个服务的 application.properties 文件就像

eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
spring.application.name=espaceService1
server.port=8080
eureka:
  instance:
    prefer-ip-address: true
    leaseRenewalIntervalInSeconds: 3
    leaseExpirationDurationInSeconds: 3
    metadata-map:
      cluster: APPCLUSTER

第二个服务的应用程序属性文件包含,

eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
spring.application.name=espaceService2
server.port=8081
eureka:
  instance:
    prefer-ip-address: true
    leaseRenewalIntervalInSeconds: 3
    leaseExpirationDurationInSeconds: 3
    metadata-map:
      cluster: APPCLUSTER

这些是我的实施细节。

在我获取 URL 后“http://localhost:8085/hystrix.dashboard http://localhost:8085/hystrix.dashboard”。并粘贴“http://localhost:8085/turbine.stream?cluster=APPCLUSTER http://localhost:8085/turbine.stream?cluster=APPCLUSTER”。但是出现“无法连接到 Command Metric Stream”之类的错误。添加下面的屏幕截图。


您需要删除逗号分隔的服务名称中的空格

turbine.aggregator.cluster-config=espace-Second_Microservice,espaceFirst_Microservice

您无法聚合来自不同集群名称的流,要么在 espace-Second_Microservice 和 espace-First_Microservice 中使用同一个集群名称,要么根本不使用集群。

To define one cluster name use below config

    eureka:
      instance:
        prefer-ip-address: true
        leaseRenewalIntervalInSeconds: 3
        leaseExpirationDurationInSeconds: 3
        metadata-map:
          cluster: APPCLUSTER

使用下面提到的涡轮机配置

turbine:
  aggregator:
    clusterConfig: APPCLUSTER
  app-config: espace-Second_Microservice,espace-First_Microservice
  instanceUrlSuffix.APPCLUSTER: /hystrix.stream

在 Hystrix 仪表板中使用 http://{turbine host}:{turbine Port}/turbine.stream?cluster=APPCLUSTER

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Turbine 仪表板未加载 Spring Cloud 微服务中的聚合 的相关文章

随机推荐