微服务架构之spring cloud turbine
在前面介绍了spring cloud hystrix及其hystrix dashboard,但都是对单个项目的监控,对于一个为项目而言,必定有很多微服务,一个一个去看非常的不方便,如果有一个能集中熔断器监控的地方就完美了,spring cloud turbine 就实现了这样的功能,这篇文章就来介绍spring cloud turbine。
(一) 版本说明
a) Spring boot 2.0.6.RELEASE
b) Spring cloud Finchley.SR2
c) Java version 1.8
d) spring-cloud-starter-netflix-hystrix 2.0.2.RELEASE
e) spring-cloud-starter-netflix-hystrix-dashboard 2.0.2.RELEASE
f) spring-cloud-starter-netflix-turbine 2.0.2.RELEASE
(二) 项目配置
1. 项目设置
a) POM设置
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine</artifactId> </dependency>
b) application.yml配置文件
eureka: datacenter: ctm environment: dev instance: hostname: 192.168.1.78 prefer-ip-address: true ip-address: 192.168.1.129 lease-renewal-interval-in-seconds: 10 lease-expiration-duration-in-seconds: 30 instance-id: ${eureka.instance.ip-address}:${server.port} client: service-url: defaultZone: http://${eureka.instance.hostname}:1001/eureka/,http://${eureka.instance.hostname}:1002/eureka/,http://${eureka.instance.hostname}:1003/eureka/ fetch-registry: true register-with-eureka: true healthcheck: enabled: true turbine: aggregator: cluster-config: default app-config: clientservice,callbackservice cluster-name-expression: new String("default")
c) 主要参数说明
i. eureka.instance.prefer-ip-address 使用IP显示注册信息
ii. eureka.instance.ip-address 实例IP地址,
iii. eureka.instance.instance-id 自定义实例id,服务之间调用就是使用该配置,多个实例必须保证唯一性
iv. eureka.client.service-url.defaultZone 注册中心地址
v. turbine.app-config 设置要聚集的服务名称,这里是指注册的服务名字
2. 项目运行
a) 运行要监控的服务
i. 为了演示聚集的效果,这里运行了2个服务者实例后,会在服务中心看到如下效果
b) 运行
i. 运行turbine项目,如下图所示
c) 在浏览器中输入消费者地址服务地址,即可看到如下效果
在看板地址中输入http://localhost:1251/turbine.stream,然后点击Monitor Stream 按钮,即可看到熔断器监控,如果没有数据显示,可以用任何客户端调用几次API,即可看到聚合后的效果。
这样spring cloud turbine就介绍完了,如果在开发中遇到问题,也可以留言共同探讨共同进步。
微服务架构之spring cloud turbine的更多相关文章
- 微服务架构-选择Spring Cloud,放弃Dubbo
Spring Cloud 在国内中小型公司能用起来吗?从 2016 年初一直到现在,我们在这条路上已经走了一年多. 在使用 Spring Cloud 之前,我们对微服务实践是没有太多的体会和经验的.从 ...
- 微服务架构集大成者—Spring Cloud (转载)
软件是有生命的,你做出来的架构决定了这个软件它这一生是坎坷还是幸福. 本文不是讲解如何使用Spring Cloud的教程,而是探讨Spring Cloud是什么,以及它诞生的背景和意义. 1 背景 2 ...
- 微服务架构之spring cloud 介绍
在当前的软件开发行业中,尤其是互联网,微服务是非常炽热的一个词语,市面上已经有一些成型的微服务框架来帮助开发者简化开发工作量,但spring cloud 绝对占有一席之地,不管你是否为java开发,大 ...
- 微服务架构之spring cloud eureka
Spring Cloud Eureka是spring cloud的核心组件,负责服务治理功能,起到中心枢纽作用,其它组件都依赖eureka来获取服务,然后再根据项目需求实现自己的业务,eureka在整 ...
- 微服务架构之spring cloud zipkin
Spring Cloud Zipkin是微服务的链路跟踪组件,帮助详细了解一次request&response的总计时,及每个微服务的消耗时间.微服务名称.异常信息等等过程信息. (一) 版本 ...
- 微服务架构之spring cloud gateway
Spring Cloud Gateway是spring cloud中起着非常重要的作用,是终端调用服务的入口,同时也是项目中每个服务对外暴露的统一口径,我们可以在网关中实现路径映射.权限验证.负载均衡 ...
- 微服务架构之spring cloud hystrix&hystrix dashboard
在前面介绍spring cloud feign中我们已经使用过hystrix,只是没有介绍,spring cloud hystrix在spring cloud中起到保护微服务的作用,不会让发生的异常无 ...
- 微服务架构之spring cloud feign
在spring cloud ribbon中我们用RestTemplate实现了服务调用,可以看到我们还是需要配置服务名称,调用的方法 等等,其实spring cloud提供了更优雅的服务调用方式,就是 ...
- 微服务架构之spring cloud ribbon
现在负载均衡是通用的解决分压的技术方案,实现方式一般分为服务端或者客户端,服务端大部分是使用中间件实现,spring cloud ribbon 是一个客户端负载均衡组件.跟spring cloud e ...
随机推荐
- P1091 合唱队列
合唱队列 原题:传送门 核心代码: /* 方法求出每一个点的最长升子序列和最长降子序列,再加到该点上 通过循环比较哪个点最大,再用总长减去该点长度即是答案 */ #include<iostrea ...
- springcloud(十)-Zuul微服务网关
为什么要使用微服务网关 前面的文章我们介绍了,Eureka用于服务的注册于发现,Feign支持服务的调用以及均衡负载,Hystrix处理服务的熔断防止故障扩散,Spring Cloud Config服 ...
- 5 个 iOS 和 Android 最佳的开源自动化工具[转]
自动化测试时下在产品测试上有着非常重要的作用.实现测试自动化有多种积极的方式,包括最大限度地减少测试执行时间:在关键的发布阶段,用更少的时间确保更大的覆盖范围:在产品开发阶段,可靠又重复性地运行以确保 ...
- 单独安装VS2012装mono for android
直接安装个SQL Server2012,然后就可以单独安装VS2012 来用mono for android了.如果不想装,那就装以下这些东西. 广州-PC286() 11:05:28 和 x86 ...
- 虚拟机实现finally语句块
1.ret.jsr.jsr_w与returnAddress指令实现finally语句块 当class文件的版本号等于或高于51.0,jsr和jsr_w这两个操作码也不能出现在code数组中. 所有re ...
- 微服务Kong(七)——CLI参考
KONG提供了一套CLI(命令行界面)命令,您可以通过它来启动.停止和管理您的Kong实例.CLI管理您的本地节点(如在当前机器上). 全局配置 所有命令都采用一组指定的可选标志作为参数: --hel ...
- POJ 3481 Double Queue(set实现)
Double Queue The new founded Balkan Investment Group Bank (BIG-Bank) opened a new office in Buchares ...
- Mathematik
Ausdruck auf Deutsch Lösen Problem der Abteilung. 求导. Die Abteilung von 3x ist 3. 3x的导数是3 Lösen Prob ...
- [转]Web Api系列教程第2季(OData篇)(二)——使用Web Api创建只读的OData服务
本文转自:http://www.cnblogs.com/fzrain/p/3923727.html 前言 很久没更新了,之前有很多事情,所以拖了很久,非常抱歉.好了,废话不多说,下面开始正题.本篇仍然 ...
- 把IP字符串转换为IPv4标准格式
把IP字符串转换为IPv4标准格式,如一个IP为127.0.0.1转为127.000.000.001格式? 即是说“点”分隔的数据不够三位数字长度,转换为三位数字长度. Insus.NET有尝试写了一 ...