这几天学习spring cloud,配置Hystrix Dashboard的时候出现了Unable to connect to Command Metric Stream.问题。
说明一下环境架构。Eureka server和Eureka Server Provider,Server Consumer里引入了Ribbon和Hystrix用以调用Server Provider的服务。
Server Consumer的地址是http://localhost,端口8060,那么Hystrix Dashboard里填入的监控地址就应该是http://localhost:8060/actuator/hystrix.stream,能正常的看到不断的打印出ping(如下图),那说明服务本身没有问题。

接下来,在Hystrix Dashboard面板中填入上述地址,我出现了Unable to connect to Command Metric Stream.。

看看log
Origin parameter: http://localhost:8060/actuator/hystrix.stream is not in the allowed list of proxy host names. If it should be allowed add it to hystrix.dashboard.proxyStreamAllowList.
大致的意思是localhost代理主机名的允许列表中。 如果应允许将其添加到hystrix.dashboard.proxyStreamAllowList。
那么接下来就配置了,在HystrixDashboard工程加入配置。
hystrix:
dashboard:
proxy-stream-allow-list: "localhost"
重新启动工程

完美解决。

本文介绍了解决Spring Cloud中Hystrix Dashboard出现的Unable to connect to Command Metric Stream问题的方法。通过配置允许代理主机名列表,成功实现了监控功能。
4014

被折叠的 条评论
为什么被折叠?



