博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第十一篇: Turbine(Hoxton版本)
阅读量:4182 次
发布时间:2019-05-26

本文共 4008 字,大约阅读时间需要 13 分钟。

新建一个service-turbine

pom

4.0.0
com.xiaobu
springcloud-demo
0.0.1-SNAPSHOT
service-turbine
0.0.1-SNAPSHOT
service-turbine
service-turbine project for Spring Boot
1.8
org.springframework.boot
spring-boot-starter
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.boot
spring-boot-starter-actuator
org.springframework.cloud
spring-cloud-starter-netflix-hystrix
org.springframework.cloud
spring-cloud-starter-netflix-hystrix-dashboard
org.springframework.cloud
spring-cloud-starter-netflix-turbine
org.springframework.cloud
spring-cloud-dependencies
${spring-cloud.version}
pom
import
org.springframework.boot
spring-boot-maven-plugin

application.properties

server.port=8012spring.application.name=service-turbineeureka.client.serviceUrl.defaultZone=http://localhost:8001/eureka/management.endpoints.web.exposure.include=*management.endpoints.web.cors.allowed-origins=*management.endpoints.web.cors.allowed-methods=*turbine.app-config=hystrix-dashboard-service-hi,hystrix-dashboard-service-hi2turbine.aggregator.clusterConfig=defaultturbine.clusterNameExpression=new String("default")turbine.combine-host=trueturbine.instanceUrlSuffix.default=actuator/hystrix.stream

ServiceTurbineApplication.java

package com.xiaobu;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Value;import org.springframework.boot.CommandLineRunner;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.netflix.eureka.EnableEurekaClient;import org.springframework.cloud.netflix.hystrix.EnableHystrix;import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;import org.springframework.cloud.netflix.turbine.EnableTurbine;import org.springframework.web.bind.annotation.RestController;@SpringBootApplication@EnableEurekaClient@EnableDiscoveryClient@RestController@EnableHystrix@EnableHystrixDashboard@EnableCircuitBreaker@EnableTurbine@Slf4jpublic class ServiceTurbineApplication  implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(ServiceTurbineApplication.class, args); } @Value("${server.port}") private String port; @Override public void run(String... args) throws Exception {
log.info("service-turbine在端口:{},启动成功....",port); }}

依次启动eureka-server、hystrix-dashboard-service-hi(在不同的端口启动两个实例)、service-turbine

访问 http://localhost:8012/turbine.stream

1611135145(1).jpg

请求 http://localhost:8010/hi?name=admin http://localhost:8011/hi?name=admin任意一个

访问 http://localhost:8010/hystrix 监控 http://localhost:8012/turbine.stream

鼠标悬浮数据上面可以看属性说明

1611135268(1).jpg

参考:

转载地址:http://bkgai.baihongyu.com/

你可能感兴趣的文章
HTML5学习之——HTML 5 应用程序缓存
查看>>
HTML5学习之——HTML 5 服务器发送事件
查看>>
SVG学习之——HTML 页面中的 SVG
查看>>
SVG 滤镜学习之——SVG 滤镜
查看>>
mysql中用命令行复制表结构的方法
查看>>
hbase shell出现ERROR: org.apache.hadoop.hbase.ipc.ServerNotRunningYetException
查看>>
让代码变得更优雅-Lombok
查看>>
解决Rhythmbox乱码
查看>>
豆瓣爱问共享资料插件发布啦
查看>>
kermit的安装和配置
查看>>
vim 配置
查看>>
openocd zylin
查看>>
linux中cat命令使用详解
查看>>
java中的异常机制
查看>>
商务智能-基本方法-数据钻取
查看>>
C++程序员技术需求规划(发展方向)
查看>>
JNI
查看>>
IOS程序开发框架
查看>>
安装jdk的步骤
查看>>
简述JAVA运算符
查看>>