博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring cloud(Greenwich.M2) hystrix dashboard 报/actuator/hystrix.stream 404 Not Found的问题
阅读量:4563 次
发布时间:2019-06-08

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

consumer端不引用spring-boot-starter-actuator的情况

Consumer端会报Unable to connect to Command Metric Stream。新建HystrixConfiguration类加入以下代码:

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;import org.springframework.boot.web.servlet.ServletRegistrationBean;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;@Configurationpublic class HystrixConfiguration {    @Bean    public ServletRegistrationBean
getServlet(){ HystrixMetricsStreamServlet hystrixMetricsStreamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean
servletRegistrationBean = new ServletRegistrationBean(); servletRegistrationBean.setServlet(hystrixMetricsStreamServlet); servletRegistrationBean.addUrlMappings("/hystrix.stream"); servletRegistrationBean.setName("HystrixMetricsStreamServlet"); return servletRegistrationBean; }}

hystrix-dashboord输入的地址为http://consumerhost:port/hystrix.stream 

 

turbine站点配置文件加入:

turbine.appConfig=xxx1,xxx2,x3turbine.instanceUrlSuffix=/hystrix.stream

xxx1为consumer端配置的应用程序名(如spring.application.name=xxx1),通过eareka-server自动找到对应的consumer接口http://consumerhost:port/hystrix.stream去抓取信息显示到turbine聚合界面上。

由于spring-boot-starter-actuator的默认context-path为actuator,若turbine.instanceUrlSuffix不做设置,默认路径为/actuator/hystrix.stream,与我们在consumer中设置的路径/hystrix.stream不匹配,所以出现/actuator/hystrix.stream 404 Not Found。

 

聚合hystrix-dashboord输入的地址为http://consumerhost:port/turbine.stream

 

 

consumer端引用spring-boot-starter-actuator的情况(推荐)

consumer端暴露/actuator/hystrix.stream,/actuator/info,/actuator/health这3个endpoint,配置文件中加入:

management.endpoints.web.exposure.include=hystrix.stream,health,info

 默认值为health,info

 

hystrix-dashboord输入的地址为http://consumerhost:port/actuator/hystrix.stream 

 

turbine站点配置文件加入:

turbine.appConfig=xxx1,xxx2,xxx3turbine.instanceUrlSuffix=/actuator/hystrix.stream
/actuator/hystrix.stream为默认地址也可以不写。

 聚合hystrix-dashboord输入的地址为http://consumerhost:port/turbine.stream

 

转载于:https://www.cnblogs.com/wintersoft/p/10027832.html

你可能感兴趣的文章
Android 中LinearLayout控件属性
查看>>
面向对象之多态性
查看>>
树状数组
查看>>
【2019.8.14 慈溪模拟赛 T1】我不是!我没有!别瞎说啊!(notme)(BFS+DP)
查看>>
多任务--进程 及 进程间通信
查看>>
多线程/多进程+QProgressBar实现进度条
查看>>
多任务(进程)案例----- 拷贝文件夹
查看>>
Kotlin的快速入门
查看>>
底层原理
查看>>
21. Merge Two Sorted Lists
查看>>
shiro设置加密算法源码解析
查看>>
第二次冲刺
查看>>
实验四
查看>>
win8.1镜像制作
查看>>
Windows 服务开发框架介绍 - Topshelf
查看>>
php,字符串(二)
查看>>
Sizzle前奏
查看>>
Paint Chain HDU - 3980(sg)
查看>>
Chales常用操作
查看>>
C++ 运算符重载<<
查看>>