在 Spring Cloud 微服务中未加载涡轮仪表板进行聚合 [英] Turbine Dashboard Is not Loading for Aggregation in Spring Cloud Microservice
问题描述
我正在尝试使用 spring MVC 和 spring 引导框架开发一个 spring 云微服务.和 Eureka 服务器、Zuul、Ribbon、hystrix 和 Turbine 用于 Spring Cloud.我已经开发了一个微服务并且只实现了 hystrix 仪表板.我可以使用 hystrix 仪表板.现在我正在实施更多服务.所以我选择了涡轮机来聚合监控.但它没有获得仪表板.我在单独的 Spring Boot 项目中实现了涡轮机.
我的 pom.xml 包含,
<依赖><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></依赖><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-hystrix</artifactId></依赖><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-hystrix-dashboard</artifactId></依赖><依赖><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-turbine</artifactId></依赖>
我的主类包含,
@SpringBootApplication@EnableHystrixDashboard@EnableCircuitBreaker@EnableTurbine公共类 ZTurbineClientApplication {公共静态无效主(字符串 [] args){SpringApplication.run(ZTurbineClientApplication.class, args);}}
和我的 Turbine 项目 application.properties 文件包含,
server.port=8085spring.application.name=espace-涡轮eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/eureka.client.register-with-eureka=trueeureka.client.fetch-registry=true涡轮:聚合器:集群配置:APPCLUSTER应用配置:espaceService1,espaceService2instanceUrlSuffix.APPCLUSTER:/hystrix.stream
以及我之前的第一个服务的 application.properties 文件,如
eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/eureka.client.register-with-eureka=trueeureka.client.fetch-registry=truespring.application.name=espaceService1服务器端口=8080尤里卡:实例:首选 IP 地址:true租赁续订IntervalInSeconds:3租赁到期持续时间秒:3元数据映射:集群:APPCLUSTER
第二个服务的应用程序属性文件包含,
eureka.client.serviceUrl.defaultZone=http://localhost:8071/eureka/eureka.client.register-with-eureka=trueeureka.client.fetch-registry=truespring.application.name=espaceService2server.port=8081尤里卡:实例:首选 IP 地址:true租约续订IntervalInSeconds:3租赁到期持续时间秒:3元数据映射:集群:APPCLUSTER
这些是我的实现细节.
在我获取 URL
您需要从逗号分隔的服务名称中删除空格
turbine.aggregator.cluster-config=espace-Second_Microservice,espaceFirst_Microservice
不能聚合来自不同集群名称的流,要么在 espace-Second_Microservice 和 espace-First_Microservice 中使用一个集群名称,要么根本不使用集群.
定义一个集群名称使用下面的配置尤里卡:实例:首选 IP 地址:true租赁续订IntervalInSeconds:3租赁到期持续时间秒:3元数据映射:集群:APPCLUSTER
使用下面提到的涡轮机配置
涡轮:聚合器:集群配置:APPCLUSTERapp-config: espace-Second_Microservice,espace-First_MicroserviceinstanceUrlSuffix.APPCLUSTER:/hystrix.stream
在 Hystrix Dashboard 中使用 http://{turbine host}:{turbine Port}/turbine.stream?cluster=APPCLUSTER
I am trying to develop a spring cloud microservice using spring MVC and spring boot framework. And Eureka server , Zuul , Ribbon , hystrix and Turbine using for spring cloud. I already developed a microservice and implemented only hystrix dashboard. I am able to take hystrix dashboard. Now I am implementing more services. So I choosed turbine for aggregation of monitoring. But it not getting the dashboard.I implemented turbine in separate spring boot project.
My pom.xml containing,
<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>
And My main class containing,
@SpringBootApplication
@EnableHystrixDashboard
@EnableCircuitBreaker
@EnableTurbine
public class ZTurbineClientApplication {
public static void main(String[] args) {
SpringApplication.run(ZTurbineClientApplication.class, args);
}
}
And my Turbine project application.properties file containing,
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
And My previous first services's application.properties file like
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
And second service's application property file contains,
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
these are my implementation details.
After I took URL "http://localhost:8085/hystrix.dashboard". And pasted "http://localhost:8085/turbine.stream?cluster=APPCLUSTER". But getting error like "Unable to connect to Command Metric Stream". Adding screenshots below.
You need to remove space from comma separated service names
turbine.aggregator.cluster-config=espace-Second_Microservice,espaceFirst_Microservice
You cannot aggregate streams from different cluster names, either use one cluster name in both espace-Second_Microservice and espace-First_Microservice or don't use cluster at all.
To define one cluster name use below config
eureka:
instance:
prefer-ip-address: true
leaseRenewalIntervalInSeconds: 3
leaseExpirationDurationInSeconds: 3
metadata-map:
cluster: APPCLUSTER
Use below mentioned config for turbine
turbine:
aggregator:
clusterConfig: APPCLUSTER
app-config: espace-Second_Microservice,espace-First_Microservice
instanceUrlSuffix.APPCLUSTER: /hystrix.stream
Use http://{turbine host}:{turbine Port}/turbine.stream?cluster=APPCLUSTER in Hystrix Dashboard
这篇关于在 Spring Cloud 微服务中未加载涡轮仪表板进行聚合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!