turbine java_Spring Cloud之服务监控turbine的示例
turbine是聚合服务器发送事件流数据的一个工具,hystrix的监控中,只能监控单个节点,实际生产中都为集群,因此可以通过turbine来监控集群下hystrix的metrics情况,通过eureka来发现hystrix服务。
新建turbine项目
TurbineApplication.java
package turbine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
/**
* Created by sai.luo on 2017/4/26.
*/
@SpringBootApplication
@EnableTurbine
@EnableHystrix
@EnableHystrixDashboard
public class TurbineApplication{
public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class,args);
}
}
pom.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
turbine
UTF-8
1.8
org.springframework.boot
spring-boot-starter-parent
1.5.2.RELEASE
org.springframework.cloud
spring-cloud-starter-hystrix
org.springframework.cloud
spring-cloud-starter-hystrix-dashboard
org.springframework.cloud
spring-cloud-starter-turbine
org.springframework.cloud
spring-cloud-dependencies
Camden.SR5
pom
import
org.springframework.boot
spring-boot-maven-plugin
application.yml
spring:
application:
name: turbine
server:
port: 8000
turbine:
app-config: hello,helloClient ##需要监控的服务名
aggregator:
clusterConfig: main ##需要监控的服务集群名
clusterNameExpression: metadata['cluster']
eureka:
instance:
preferIpAddress: true
statusPageUrlPath: /info.html
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
启动服务
helloserviceeureka 项目 appliation.yml 增加集群配置
更改为
spring:
application:
name: hello
server:
port: 9001
eureka:
instance:
lease-renewal-interval-in-seconds: 3
lease-expiration-duration-in-seconds: 5
metadata-map:
cluster: main
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
registry-fetch-interval-seconds: 3
logging:
level:
com:
netflix:
eureka: OFF
discovery: OFF
pom.xml增加hystrix依赖包
org.springframework.cloud
spring-cloud-starter-hystrix
同理ribboneureka 项目 application.yml 增加集群配置
更改后如下
spring:
application:
name: helloClient
server:
port: 20000
eureka:
instance:
lease-renewal-interval-in-seconds: 3
lease-expiration-duration-in-seconds: 5
metadata-map:
cluster: main
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
registry-fetch-interval-seconds: 3
logging:
level:
com:
netflix:
eureka: OFF
discovery: OFF
pom.xml增加hystrix依赖包
RibbonEurekaApplication.java 增加注解
@EnableHystrix
启动项目
访问 localhost:8000/hystrixx 可以看到页面
注: turbine只能监控hystrix服务,不是hystrix服务,不能监控,如 hello这个服务虽然配置了集群,但是没有使用hystrix,所以不会受监控。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。
turbine java_Spring Cloud之服务监控turbine的示例相关推荐
- Hystrix 集群 及 集群监控 Turbine
Hystrix 集群 及 集群监控 turbine Hystrix 集群及监控 turbine Feign.Hystrix整合 集群后超时设置 本章知识: 1.Hystrix集群及监控turbine ...
- 微服务监控方案(skywalking)
1.概述 通过自建的监控和分布式调用链分析工具,帮助用户掌握微服务上线后的运行状况. 应用监控的指标包括应用的 QPS, 请求时间和请求出错率等.分布式调用链分析包括调用链查询和调用链详情.可以根据时 ...
- SpringCloud系列七:Hystrix 熔断机制(Hystrix基本配置、服务降级、HystrixDashboard服务监控、Turbine聚合监控)...
声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念:Hystrix 熔断机制 2.具体内容 所谓的熔断机制和日常生活中见到电路保险丝是非常相似的,当出现了问题之后,保险丝 ...
- SpringCloud:Hystrix 熔断机制(基本配置、服务降级、HystrixDashboard服务监控、Turbine聚合监控)
所谓的熔断机制和日常生活中见到电路保险丝是非常相似的,当出现了问题之后,保险丝会自动烧断,以保护我们的电器, 那么如果换到了程序之中呢?当现在服务的提供方出现了问题之后整个的程序将出现错误的信息显示, ...
- Spring Cloud 入门——6.1 Turbine 集群数据监控
代码信息 本篇文章涉及代码版本 组件 版本 Spring Boot 2.0.8.RELEASE Spring Cloud Finchley.SR1 本篇文章涉及应用 应用 说明 base-eureka ...
- 微服务和VUE入门教程(26): 微服务之turbine
微服务和VUE入门教程(26): 微服务之turbine 微服务和VUE入门教程(0): 着手搭建项目 微服务和VUE入门教程(1): 搭建前端登录界面 微服务和VUE入门教程(2): 注册中心 微服 ...
- hystrix集群及集群监控turbine
文章目录 一.hystrix集群及监控turbine 二.feign.hystrix整合之服务熔断服务降级彻底解耦 三.集群后超时设置 一.hystrix集群及监控turbine 前面dashboar ...
- Spring Cloud Sleuth + Zipkin 监控微服务(一)
在之前搭建的服务注册中心的基础上,结合Spring Cloud Sleuth + Zipkin 监控微服务. 1.Zipkin server 从https://dl.bintray.com/openz ...
- 《深入理解 Spring Cloud 与微服务构建》第十五章 微服务监控 Spring Boot Admin
<深入理解 Spring Cloud 与微服务构建>第十五章 微服务监控 Spring Boot Admin 文章目录 <深入理解 Spring Cloud 与微服务构建>第十 ...
最新文章
- LeetCode Reverse Vowels of a String
- 谷歌云使用账号密码_如何使用Google密码检查
- 别转管理,十年程序员老鸟给新手的几条忠告(转)
- string的compare operator
- 【Qt教程】3.4 - Qt5 QPainter绘图事件、绘图功能
- anaconda中的python在pycharm中用不了_pycharm与anaconda的使用
- 火影忍者里的忍术日文发音
- 无人机——电调篇(二)
- 网络存储服务器接显示器,Unraid下,单核显IGPU实现win10外接显示屏,显卡成功驱动...
- 电脑鼠标右键失效linux,鼠标右键失灵,教你win7电脑鼠标右键失灵的应对办法
- windows11中如何显示此电脑图标
- 立方体图片的在线绘制与制作
- (三)、IText通过pdf模板生成pdf文件(可用做回执单等功能)
- STM32F429 13. SPI 通讯(code)
- apicloud打开地图导航
- pmp中ram和raci的区别_【PMP考前冲刺】知识点大全(六)
- 1个免费网站教你如何追踪微信实时热点,速速收藏
- python输入姓和名_编程练习1-输入姓,返回名
- 深度剖析QQ密码被盗原因
- 脚印(Foot Print)效果制作