Turbine Dashboard未加载Spring Cloud微服务中的聚合

时间:2017-12-05 15:41:27

标签: spring-cloud turbine

我正在尝试使用spring MVC和spring boot framework开发一个spring cloud微服务。和Eureka服务器,Zuul,Ribbon,hystrix和Turbine用于春天云。我已经开发了一个微服务并且只实现了hystrix仪表板。我可以使用hystrix仪表板。现在我正在实施更多服务。因此,我选择涡轮机进行监控聚合。但它没有获得仪表板。我在单独的弹簧启动项目中实施了涡轮机。

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

我的Turbine项目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

这些是我的实施细节。

我使用网址“also present”后。并粘贴“http://localhost:8085/hystrix.dashboard”。但是得到的错误就像“无法连接到Command Metric Stream”。在下面添加屏幕截图。

http://localhost:8085/turbine.stream?cluster=APPCLUSTER

enter image description here

1 个答案:

答案 0 :(得分:0)

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

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