Spring Cloud 学习——熔断监控Turbine

Turbine

在复杂的分布式系统中,相同服务的节点经常需要部署上百甚至上千个,很多时候,运维人员希望能够把相同服务的节点状态以一个整体集群的形式展现出来,这样可以更好的把握整个系统的状态。 为此,Netflix提供了一个开源项目(Turbine)来提供把多个hystrix.stream的内容聚合为一个数据源供Dashboard展示。

Turbine实现监控Hystrix

Turbine子项目搭建

继续之前的maven工程创建

项目结构

pom文件

<!--暴露各种指标-->
 <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-netflix-turbine</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-netflix-hystrix-dashboard</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

yml配置

server:
  port: 12000
eureka:
  client:
    service-url:
      defaultZone: http://eureka01:8800/eureka/,http://eureka02:8810/eureka/


turbine:
  aggregator:
    # 指定聚合哪些集群,多个使用","分割,默认为default。可使用http://.../turbine.stream?cluster={clusterConfig之一}访问
    clusterConfig: default
    # 配置Eureka中的serviceId列表,表明监控哪些服务
  appConfig: consumer-ribbon-hystrix,consumer-feign-hystrix
    #设置监控的表达式,通过此表达式表示要获取监控信息名称
  clusterNameExpression: new String("default")

spring:
  application:
    name: service-turbine
  main:
    allow-bean-definition-overriding: true

启动类

@SpringBootApplication
@EnableTurbine
@EnableHystrixDashboard//启用Hystrix Dashboard
public class ServiceTurbineApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServiceTurbineApplication.class, args);
    }

}

启动

加入我们

如果有需要,欢迎可以加入我们的QQ群!(QQ搜索 1074281704, 加入我们的QQ群吧!)
有任何问题,也可以加入我们的QQ群,欢迎交(che)流(dan)!

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

答 案

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值