Jac*_*cob 14 turbine spring-cloud
我正在尝试使用spring MVC和spring boot框架开发一个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>
Run Code Online (Sandbox Code Playgroud)
而我的主要课程包含,
@SpringBootApplication
@EnableHystrixDashboard
@EnableCircuitBreaker
@EnableTurbine
public class ZTurbineClientApplication {
public static void main(String[] args) {
SpringApplication.run(ZTurbineClientApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
我的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
Run Code Online (Sandbox Code Playgroud)
和我以前的第一个服务的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
Run Code Online (Sandbox Code Playgroud)
第二个服务的应用程序属性文件包含,
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
Run Code Online (Sandbox Code Playgroud)
这些是我的实施细节.
我拿了URL" http:// localhost:8085/hystrix.dashboard ".并粘贴" http:// localhost:8085/turbine.stream?cluster = APPCLUSTER ".但是得到的错误就像"无法连接到Command Metric Stream".在下面添加屏幕截图.
您需要删除逗号分隔的服务名称中的空格
turbine.aggregator.cluster-config=espace-Second_Microservice,espaceFirst_Microservice
Run Code Online (Sandbox Code Playgroud)
您无法聚合来自不同集群名称的流,要么在 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
Run Code Online (Sandbox Code Playgroud)
使用下面提到的涡轮机配置
turbine:
aggregator:
clusterConfig: APPCLUSTER
app-config: espace-Second_Microservice,espace-First_Microservice
instanceUrlSuffix.APPCLUSTER: /hystrix.stream
Run Code Online (Sandbox Code Playgroud)
在 Hystrix 仪表板中使用 http://{turbine host}:{turbine Port}/turbine.stream?cluster=APPCLUSTER
| 归档时间: |
|
| 查看次数: |
796 次 |
| 最近记录: |