• turbine 集群聚合监控


    hystrix + turbine 集群聚合监控

    ystrix dashboard 一次只能监控一个服务实例,使用 turbine 可以汇集监控信息,将聚合后的信息提供给 hystrix dashboard 来集中展示和监控

    使用步骤

    前提

    已经有了部分业务项目, 并使用feign进行了远程调用, 且业务项目绑定了注册中心

    1. 新建项目导入依赖

    创建springboot项目, 并导入: Turbine, Eureka Discovery Client

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
    </dependency>
    

    2. 配置文件application.yml

    spring:
      application:
        name: turbin
        
    server:
      port: 5001
      
    eureka:
      client:
        service-url:
          defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
          
    turbine:
      app-config: order-service
      cluster-name-expression: new String("default")
    

    3. 主程序添加注解

    添加 @EnableTurbine@EnableDiscoveryClient (高版本可省略此注解) 注解

    @EnableTurbine
    // @EnableDiscoveryClient 高版本springboot可省略
    @SpringBootApplication
    public class Sp10TurbineApplication {
    
    	public static void main(String[] args) {
    		SpringApplication.run(Sp10TurbineApplication.class, args);
    	}
    
    }
    

    4. 访问测试

    turbine 监控路径 http://localhost:5001/turbine.stream

    我们使用仪表盘的时候, 只需要输入此路径即可

    如果有相同的服务器进行了负载均衡, 再仪表盘面板可以看到属性 hosts = 2 或者更多(负载均衡服务)

  • 相关阅读:
    WebSocket来实现即时通讯
    微信小程序1
    使用phpqrcode来生成二维码/thinkphp
    PHP函数积累
    Docker 常用命令汇总(beta)
    Nginx+Keepalived高可用架构简述(beta)
    Docker镜像制作(以Nginx+Keepalived为例)(beta)
    开源协议浅谈(beta)
    【Elasticsearch系列】ES安装(mac)
    linux 下安装JDK
  • 原文地址:https://www.cnblogs.com/zpKang/p/13591405.html
Copyright © 2020-2023  润新知