- springCloud升级后。导致 HtystrixDashboard 默认的servlet请求路径修改了
- 将业务的微服务使用 HtystrixDashboard 仪表盘第一次监控时出现 Unable to connect to Command Metric Stream.
解决办法: 这都是 业务微服务端更改。不是 htystrix
- 显示的 声明一个 servlet组
-
/** *此配置是为了服务监控而配置,与服务容错本身无关,springcloud升级后的坑 *ServletRegistrationBean因为springboot的默认路径不是"/hystrix.stream", *只要在自己的项目里配置上下面的servlet就可以了 * cloud更改前的路径应该是 /actuator/hystrix */ @Bean public ServletRegistrationBean getServlet() { HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }
- 确认是否引入 actuator 的依赖
-
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
- 一切准备完成后。 访问 htystrix 检测的地址 : localhost:端口/htystrix.stream . 进行业务访问 。发现有 ping出现。说明此时客户端没有问题了
- 将此地址配入 htystrix
- 查看是否能正确访问:
- 如果还是出现 Unable to connect to Command Metric Stream. 查看一下log日志。 发现是 could'n allow list. 那么在 htystrict端的 application.yml 文件中。配置host允许
hystrix: dashboard: proxy-stream-allow-list: localhost
分类:
SpringBoot
, SpringCloud
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通