目录
TurbineServer——Hystrix & homePageUrl
TurbineServer——Turbine & turbine.instanceUrlSuffix
TurbineServer——hystrix & management.port
-
TurbineDoc & 前言
前言:turbine是监控整个集群
https://projects.spring.io/spring-cloud/spring-cloud.html#_circuit_breaker_hystrix_clients
-
TurbineServer
- 1 pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-turbine</artifactId>
</dependency>
</dependencies>
- 2 启动类@EnableTurbine
@EnableTurbine
@SpringBootApplication
public class TurbineApplication {
public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class, args);
}
}
- 3 application.yml
server:
port: 8031
spring:
application:
name: microservice-hystrix-turbine
eureka:
client:
serviceUrl:
defaultZone: http://user:password123@localhost:8761/eureka
instance:
prefer-ip-address: true
turbine:
aggregator:
clusterConfig: microservice-consumer-movie-ribbon-with-hystrix
appConfig: customers
-
TurbineServer注册到eureka
Application | AMIs | Availability Zones | Status |
---|---|---|---|
MICROSERVICE-CONSUMER-MOVIE-RIBBON-WITH-HYSTRIX | n/a (1) | (1) | UP (1) - MTC-20180821VUN:microservice-consumer-movie-ribbon-with-hystrix:8010 |
MICROSERVICE-HYSTRIX-TURBINE | n/a (1) | (1) | UP (1) - MTC-20180821VUN:microservice-hystrix-turbine:8031 |
MICROSERVICE-PROVIDER-USER | n/a (1) | (1) | UP (1) - microservice-provider-user:192.168.4.160:7900 |
-
TurbineServer监控
1.1 http://192.168.4.160:8031/turbine.stream?cluster=microservice-consumer-movie-ribbon-with-hystrix(按照上述仅仅监控了microservice-consumer-movie-ribbon-with-hystrix如果将全部服务名称都写上的话,则问号自身和后面都不需要,浏览器会一直ping,但是无结果)
1.2 访问ribbon-with-hystrix 接口 http://192.168.4.160:8010/movie/1
1.3 1.1出结果了但是有一定的延迟<如何查看数据呢?>hystrix dashboard
1.4 hystrix-dashboard项目启动,打开localhost:port/hystrix,将1.1路径复制输入,Title: Turbine
问:如何证明turbine是监控整个集群的呢?
答: