我正在尝试使用 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”之类的错误。添加下面的屏幕截图。