热门标签 | HotTags
当前位置:  开发笔记 > 前端 > 正文

SpringCloudturbine监控实现过程解析

这篇文章主要介绍了SpringCloudturbine监控实现过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

这篇文章主要介绍了SpringCloud turbine监控实现过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

1、pom.xml文件

<&#63;xml version="1.0" encoding="UTF-8"&#63;>

  4.0.0
  
    com.test
    springcloud
    1.0-SNAPSHOT
    ../ 
  
  com.test
  eureka-client-comsumer-feign-hystrix-turbine
  0.0.1-SNAPSHOT
  eureka-client-comsumer-feign-hystrix-turbine
  Demo project for Spring Boot

  
    1.8
    Greenwich.SR1
  

  
    
      org.springframework.boot
      spring-boot-starter-web
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-hystrix-dashboard
    
    
      org.springframework.boot
      spring-boot-starter-actuator
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-eureka-client
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-hystrix
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-turbine
    
    
      org.springframework.cloud
      spring-cloud-starter-openfeign
    

    
      org.springframework.boot
      spring-boot-starter-test
      test
      
        
          org.junit.vintage
          junit-vintage-engine
        
      
    
  

  
    
      
        org.springframework.cloud
        spring-cloud-dependencies
        ${spring-cloud.version}
        pom
        import
      
    
  

  
    
      
        org.springframework.boot
        spring-boot-maven-plugin
      
    
  

主要添加了一下几个依赖:


      org.springframework.boot
      spring-boot-starter-web
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-hystrix-dashboard
    
    
      org.springframework.boot
      spring-boot-starter-actuator
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-eureka-client
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-hystrix
    
    
      org.springframework.cloud
      spring-cloud-starter-netflix-turbine
    
    
      org.springframework.cloud
      spring-cloud-starter-openfeign
    

2、添加注解

package com.test.eurekaclientcomsumerfeignhystrixturbine;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
@EnableCircuitBreaker
@EnableTurbine
@EnableHystrixDashboard
/**
 * Dashboard访问地址:http://localhost:7016/hystrix
 * 在Dashboard输入 http://localhost:7016/turbine.stream
 */
public class EurekaClientComsumerFeignHystrixTurbineApplication {

  @Bean
  public ServletRegistrationBean getServlet(){
    HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
    ServletRegistrationBean registratiOnBean= new ServletRegistrationBean(streamServlet);
    registrationBean.setLoadOnStartup(1);
    registrationBean.addUrlMappings("/actuator/hystrix.stream");
    registrationBean.setName("HystrixMetricsStreamServlet");
    return registrationBean;
  }

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

}

3、application.yml文件配置

server:
 port: 7016

spring:
 application:
  name: eureka-client-feign-hystrix-turbine
eureka:
 instance:
  hostname: localhost
  prefer-ip-address: true
  instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
 client:
  serviceUrl:
   defaultZone: http://${eureka.instance.hostname}:8761/eureka

eureka-provider: #远程服务虚拟主机名
 ribbon:
  NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RoundRobinRule

#turbine配置
turbine:
 aggregator:
  cluster-config: default
 app-config: eureka-client-feign-hystrix-turbine,eureka-client-feign-hystrix,eureka-client-feign-hystrix-dashboard
 cluster-name-expression: "'default'"

4、访问

  a)http://localhost:7016/hystrix

  b)在dashboard输入:http://localhost:7016/turbine.stream

具体的代码可访问 github:https://github.com/812406210/springCloud.git

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。


推荐阅读
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
  • 本文介绍了一些Java开发项目管理工具及其配置教程,包括团队协同工具worktil,版本管理工具GitLab,自动化构建工具Jenkins,项目管理工具Maven和Maven私服Nexus,以及Mybatis的安装和代码自动生成工具。提供了相关链接供读者参考。 ... [详细]
  • 打开文件管理器_【教程】模组管理器3.1食用指南
    文编:byakko最近有部分小伙伴反应还不会使用unity模组管理器,现在我就给大家讲一下unity模组管理器——从下载到使用。完整视频版以下是无WiF ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • EPICS Archiver Appliance存储waveform记录的尝试及资源需求分析
    本文介绍了EPICS Archiver Appliance存储waveform记录的尝试过程,并分析了其所需的资源容量。通过解决错误提示和调整内存大小,成功存储了波形数据。然后,讨论了储存环逐束团信号的意义,以及通过记录多圈的束团信号进行参数分析的可能性。波形数据的存储需求巨大,每天需要近250G,一年需要90T。然而,储存环逐束团信号具有重要意义,可以揭示出每个束团的纵向振荡频率和模式。 ... [详细]
  • VScode格式化文档换行或不换行的设置方法
    本文介绍了在VScode中设置格式化文档换行或不换行的方法,包括使用插件和修改settings.json文件的内容。详细步骤为:找到settings.json文件,将其中的代码替换为指定的代码。 ... [详细]
  • 本文介绍了在开发Android新闻App时,搭建本地服务器的步骤。通过使用XAMPP软件,可以一键式搭建起开发环境,包括Apache、MySQL、PHP、PERL。在本地服务器上新建数据库和表,并设置相应的属性。最后,给出了创建new表的SQL语句。这个教程适合初学者参考。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • javascript  – 概述在Firefox上无法正常工作
    我试图提出一些自定义大纲,以达到一些Web可访问性建议.但我不能用Firefox制作.这就是它在Chrome上的外观:而那个图标实际上是一个锚点.在Firefox上,它只概述了整个 ... [详细]
  • 安卓select模态框样式改变_微软Office风格的多端(Web、安卓、iOS)组件库——Fabric UI...
    介绍FabricUI是微软开源的一套Office风格的多端组件库,共有三套针对性的组件,分别适用于web、android以及iOS,Fab ... [详细]
  • 标题: ... [详细]
author-avatar
345877103_b54cd7
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有