Demo地址:http://git.oschina.net/zhou666/spring-cloud-7simple/tree/master/cloud-hystrix-turbinegit
hystrix-turbine集成了hystrix看板和 turbine,用來監控實現了hystrix的工程項目:web
每個監控項目的具體解釋:spring
本來的hystrix看板只能監控一臺服務器上的服務調用狀況,使用了turbine後就能夠監控多臺服務器的狀況。Turbine原理以下:服務器
<dependency>app
<groupId>org.springframework.boot</groupId>spring-boot
<artifactId>spring-boot-starter-web</artifactId>fetch
</dependency>url
<dependency>.net
<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>
配置文件:
eureka:
instance:
leaseRenewalIntervalInSeconds: 10 #心跳間隔
client:
registerWithEureka: true #註冊本工程爲服務
fetchRegistry: true
serviceUrl:
defaultZone: http://localhost:8761/eureka/ #註冊服務器地址
turbine:
aggregator:
clusterConfig: CLOUD-SIMPLE-SERVICE #turbine監控的服務名稱,能夠多個
appConfig: cloud-simple-service #turbine監控的服務,能夠有多個
clusterNameExpression: metadata['cluster']
啓動應用輸入http://localhost:8989/hystrix會看到hystrix面板,在這個面板裏的監控url輸入,http://localhost:8989/turbine.stream??cluster=CLOUD-SIMPLE-SERVICE,其中cluster對應配置文件中clusterConfig中的名稱。