zoukankan      html  css  js  c++  java
  • 使用Turbine对集群进行监控

    为什么要使用Turbine

    Turbine是聚合服务器发送事件流数据的一个工具,hystrix的监控中,只能监控单个节点,实际生产中都为集群,因此可以通过turbine来监控集群下hystrix的metrics情况,通过eureka来发现hystrix服务。

    如何使用Turbine

    前提

    新建一个springboot项目springboot-turbine

    引入Turbine

    pom.xml:

    <dependencies>
            <!-- turbine依赖 -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-turbine</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-netflix-turbine</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
        </dependencies>

    修改启动类

    在启动类上加上注解@EnableTurbine

    配置yml配置文件

    server: 
      port: 8010
    
    
    spring:
        application:
          name: xing-turbine #指定服务名
    turbine:
      aggregator:
        clusterConfig: default # 指定聚合哪些集群,多个使用","分割,默认为default。
      appConfig: XING-MOVIE # 配置Eureka中的serviceId列表,表明监控哪些服务
      clusterNameExpression: new String("default")   
              
    eureka:
      client:
        registerWithEureka: true #是否将自己注册到Eureka服务中,默认为true
        fetchRegistry:  true  #是否从Eureka中获取注册信息,默认为true
        serviceUrl: #Eureka客户端与Eureka服务端进行交互的地址
          defaultZone: http://xing-eurekaServer:8090/eureka/
        eurekaServerConnectTimeoutSeconds: 60
        eurekaServerReadTimeoutSeconds: 60
      instance:
        prefer-ip-address: true  #将自己的ip地址注册到Eureka服务中
        ip-address: 127.0.0.1
        instance-id: xing-turbine:8010 #指定实例id
        lease-expiration-duration-in-seconds: 30 #续约更新时间间隔(默认30秒)
        lease-renewal-interval-in-seconds: 10 # 续约到期时间(默认90秒)
        leaseRenewalIntervalInSeconds: 10 #心跳时间
    hostname: xing-turbine 

    查看Turbine

    启动项目,访问http://127.0.0.7:8010/turbine.stream 会看到如下图类似的界面

       

    接着访问http://127.0.0.1:8081/hystrix ,这是使用了hystrix的电影服务出现Hystrix Dashboard的界面

      

    之后会看到这个界面

  • 相关阅读:
    POJ1239
    HDU 2829 四边形不等式优化
    返回数字二进制的最高位位数o(n)
    矩阵快速幂 模板
    HDU4718 The LCIS on the Tree(LCT)
    HDU4010 Query on The Trees(LCT)
    HDU3487 Play With Chains(Splay)
    CF444C DZY Loves Colors
    HDU4836 The Query on the Tree(树状数组&&LCA)
    HDU4831&&4832&&4834
  • 原文地址:https://www.cnblogs.com/xing-12/p/10114945.html
Copyright © 2011-2022 走看看