void main(String[] args) { SpringApplication.run(App_Consumer_9001.class, args); } } step4:Turbine 监控服务 pom(spring-cloud-starter-netflix-turbine) <? build> </project> application.yaml server: port: 8001 spring: application: name: service-turbine exposure: include: "*" cors: allowed-origins: "*" allowed-methods: "*" turbine ---- 代码参考: https://github.com/HCJ-shadow/Turbine-Dashboard
1、用Turbine聚合监控数据 Hystrix Dashboard实现了数据监控,但是只能看到单个应用内的服务信息,Netflix提供了Turbine,可以把多个"hystrix.stream"的内容聚合为一个数据源供 1.1、添加依赖并启用支持 1.1.1、创建多个"服务提供者" 复制项目,修改应用名称和端口号 1.1.2、创建多个"服务消费者" 复制Feign项目,修改应用名称和端口号 1.1.3、创建Turbine 工程 1、添加Turbine依赖 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-turbine</artifactId> </dependency> 2、配置Turbine支持 在启动类上添加注解@EnableTurbine ,以激活Turbine的支持。
前面我们介绍了通过turbine直接聚合多个服务的监控信息,实现了服务的监控,但是这种方式有个不太好的地方就是turbine和服务的耦合性太强了,针对这个问题,我们可以将服务的监控消息发送到RabbitMQ 中,然后turbine中RabbitMQ中获取获取监控消息,这样就实现类服务和turbine的解耦。 能够看到是有变化的 三、创建turbine服务 1.创建项目 ? dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-turbine-stream /artifactId> </dependency> </dependencies> 3.修改配置 spring.application.name=shop-product-consumer-turbine
想要聚合所有服务熔断器的监控页面需要spring-cloud-starter-netflix-turbine。 SpringApplication.run(ProviderServiceApplication.class, args); } } 第三步 创建一个聚合工程sc-turbine-dashboard ,代码很简单除了一个启动类就是一个配置文件 下面依次贴出来,重点就是启动类加入类加入@EnableTurbine, turbine: appConfig: sc-hello-service,sc-provider-service security: enabled: false endpoints: web: exposure: include: hystrix.stream turbine clusterNameExpression: "'default'" 第四步 依次启动eureka-service,两个客户端sc-hello-service,sc-provider-service最后启动sc-turbine-dashboard
因此我们需要使用到 Turbine 来进行监控信息聚合,可以按业务组定义配置方便监控。 案例说明 案例通过添加itstack-demo-springcloud-turbine工程模块,将单体监控汇总在统一页面进行管理,此时的监控模型,如图; ? Cluster via Turbine (default cluster): http://turbine-hostname:port/turbine.stream Cluster via Turbine (custom cluster): http://turbine-hostname:port/turbine.stream? 综上总结 通过Turbine服务我们可以将监控信息汇总到一起进行查看,这样更加方便实际应用。
什么是turbine Turbine是聚合服务器发送事件流数据的一个工具,用来监控集群下hystrix的metrics情况。 Turbine通过注册中心获取对应集群下的所有微服务实例,然后依次访问每个实例的/hystrix.stream,并收集和聚合所有节点健康信息 turbine的作用 汇总系统内多个服务的数据并显示到Hystrix /turbine.stream? 汇集的系统信息 hystrix dashborad界面输入形如: http://turbine-hostname:port/turbine.stream? 小结 以上是turbine搭建的简单入门,在实际开发中,turbine通常聚合网关服务就可以,因为基本上微服务都是通过网关访问,当然要具体根据实际情况分析
使用Turbine聚合监控数据(五) Turbine是一个聚合 Hystrix监控数据的工具,它可将所有关/hystrix.stream端点的数据聚合到一个组合的/turbine.stream中,从而让集群的监控更加方便 > <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine </artifactId> </dependency> 在启动类上增加注解@EnableTurbine 编写配置文件application.yml Turbine会在Eureka Server 访问turbine监控地址:http://127.0.0.1:8031/turbine.stream,可以看到turbine的聚合监控数据。 访问dashboard地址:http://localhost:8030/hystrix,将该turbine的监控地址输入dashboard。
图中会有一些提示: Cluster via Turbine (default cluster): http://turbine-hostname:port/turbine.stream Cluster via Turbine (custom cluster): http://turbine-hostname:port/turbine.stream? server.port=8001 turbine.appConfig=node01,node02 turbine.aggregator.clusterConfig= default turbine.clusterNameExpression /turbine.stream? (Turbine) 打开eureka后台可以看到注册了三个服务: ?
2、Turbine组件 Hystrix Dashboard组件监控服务的熔断情况时,每个服务都有图形界面,当微服务数量很多时,监控非常繁杂.为了同时监控多个服务的熔断状况,Netflix开源了Hystrix 的另一个组件Turbine.Turbine用于聚合多个Hystrix Dashboard监控,将多个Hystrix Dashboard组件的数据聚集在一个面板展示,集中监控。 三、Turbine组件 node04-monitor-7002 聚合监控服务,聚集6001,和6002两个服务的监控。 <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-turbine <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-turbine
新建工程 hystrix-turbine 作为集群监控的实现服务。 2.1 file - new - module ? # 被监控服务名称 turbine.app-config= ribbon,feign # 集群名称为“default”。 # 即:“http://turbine-hostname:port/turbine.stream? turbine.combine-host-port= true 3. 类同已有的 ribbon 工程,调整已有工程 feign 工程。 /turbine.stream ?
Turbine集群监控 OK,上文我们看了一个监控单体应用的例子,在实际应用中,我们要监控的应用往往是一个集群,这个时候我们就得采取Turbine集群监控了。 Turbine有一个重要的功能就是汇聚监控信息,并将汇聚到的监控信息提供给Hystrix Dashboard来集中展示和监控。那我们就来看看Turbine集群监控如何使用。 =http://localhost:1111/eureka/ turbine.app-config=ribbon-consumer turbine.cluster-name-expression="default " turbine.combine-host-port=true 关于这个配置文件,我说如下几点: 1.turbine.app-config=ribbon-consumer指定了要监控的应用名字为ribbon-consumer 2.turbine.cluster-name-expression=”default”,表示集群的名字为default 3.turbine.combine-host-port=true表示同一主机上的服务通过
断路器集群监控Turbine 前几篇已经实现了对单个服务实例的监控,当然在实际应用中,单个实例的监控数据没有多大的价值,我们其实更需要的是一个集群系统的监控信息,这时就需要引入Turbine。 服务消费者、断路器: sc-client-turbine-hystrix-dashboard-node1 sc-client-turbine-hystrix-dashboard-node2 : 3、 服务消费者、断路器项目sc-client-turbine-hystrix-dashboard-node1、sc-client-turbine-hystrix-dashboard-node2 /turbine.stream? sc-server-turbine-hystrix-dashboard-node2 (3)sc-client-turbine-hystrix-dashboard-node1 sc-client-turbine-hystrix-dashboard-node2
一、前言 1、什么是Turbine? Turbine是Netflix开源的将Server-Sent Event(SSE)的JSON数据流聚合成单个流的工具。 也可以通过 [ http://turbine-hostname:port/turbine.stream ] 这样的URL查看聚合的监控信息。 其中Turbine.stream实际上是Turbine(version 1.0)通过访问对应服务每个实例的 http://hystrix-app:port/actuator/hystrix.stream 二、监控数据聚合:Turbine 1、创建Turbine项目 按照惯例,使用maven-archtype-quickstart模板创建项目 项 说明 GroupId io.ken.springcloud.turbine </groupId> <artifactId>turbine</artifactId> <version>1.0-SNAPSHOT</version> <name>turbine
一、前言 1、什么是Turbine? Turbine是Netflix开源的将Server-Sent Event(SSE)的JSON数据流聚合成单个流的工具。 也可以通过 [ http://turbine-hostname:port/turbine.stream ] 这样的URL查看聚合的监控信息。 其中Turbine.stream实际上是Turbine(version 1.0)通过访问对应服务每个实例的 http://hystrix-app:port/actuator/hystrix.stream 二、监控数据聚合:Turbine 1、创建Turbine项目 按照惯例,使用maven-archtype-quickstart模板创建项目 项 说明 GroupId io.ken.springcloud.turbine </groupId> <artifactId>turbine</artifactId> <version>1.0-SNAPSHOT</version> <name>turbine
参考 英文原文:https://stackabuse.com/spring-cloud-turbine/ 中文版:https://www.jb51.net/article/162726.htm 1、 Hystrix Turbine简介 2、样例演示 2.1 父级项目 <? 3.5 聚合流 Turbine可以将所有单独的hystrix.stream聚合成一个turbine.stream,以便在Hystrix Dashboard上查看 我们可以打开http://localhost :7090/turbine.stream? 3.6 Hystrix dashboard聚合视图 输入 http://localhost:7090/turbine.stream?cluster=default ? ?
Spring Cloud Turbine 上一章我们集成了Hystrix Dashboard,使用Hystrix Dashboard可以看到单个应用内的服务信息,显然这是不够的,我们还需要一个工具能让我们汇总系统内多个服务的数据并显示到 Hystrix Dashboard上,这个工具就是Turbine。 添加依赖 修改 spring-cloud-consul-monitor 的pom文件,添加 turbine 依赖包。 SpringApplication.run(ConsuleMonitorApplication.class, args); } } 修改配置 修改配置,配置注册服务信息,添加turbine 确认服务调用无误之后, 访问 http://localhost:8531/hystrix/,输入 http://localhost:8531/turbine.stream,查看监控图表。
turbine是啥就不多解释了,初次接触的可以移步spring cloud 学习(4) - hystrix 服务熔断处理 拉到最后看一下,turbine stream默认情况下启动成功后,eureka 这其实是turbine的一个bug,详情见:https://github.com/spring-cloud/spring-cloud-netflix/issues/1774 ,大概意思是说内部依赖的netty
默认集群监控:通过URL http://turbine-hostname:port/turbine.stream 开启,实现对默认集群的监控。 自定集群监控:通过URL http://turbine-hostname:port/turbine.stream? 我们这里现在是对单体 Hystrix 消费者的监控,后面整合 Turbine 集群的时候再说明后两种的监控方式。 Hystrix Dashboard上,这个工具就是Turbine。 --turbine--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-turbine
springcloud微服务实战:Eureka+Zuul+Feign/Ribbon+Hystrix Turbine+SpringConfig+sleuth+zipkin 相信现在已经有很多小伙伴已经或者准备使用 Eureka/Consul:服务发现 (根据情况选择一个) Hystrix:断路器 Zuul:智能路由 Ribbon/Feign:客户端负载均衡 (Feign用的更多) Turbine:集群监控 这里写图片描述 六、用hystrix-turbine-dashboard 做集群监控 项目在生产环境中,每个服务的访问量都不通,有些服务的访问量比较大,有时候有些服务挂了,不能继续服务,需要重启的时候, 我们并不知道,所以这时候就需要使用hystrix-turbine-dashboard做一个监控,监控所有的微服务,可以看到这个接口实时访问量,和健康状况。 访问hystrix-dashboard页面 然后在那个网址的输入框里输网址http://localhost:8900/turbine.stream,点击monitor stream。
-------------+ # 删除存储组 IoTDB> delete storage group root.turbine 创建时间序列 create timeseries root.turbine.d1 +---------------+ | child paths| +---------------+ |root.turbine.d1| |root.turbine.d2| +--------- +---------------+ | devices| +---------------+ |root.turbine.d1| |root.turbine.d2| +---------- insert into root.turbine.d1(timestamp,s1,s2) values(1,1,2); insert into root.turbine.d1(timestamp,s1, root.turbine.d1(timestamp,s1,s2) values(6,1,2); insert into root.turbine.d1(timestamp,s1,s2) values(