spring-cloud-starter-netflix-hystrix(Unable to connect to Command Metric Stream.)

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

 

这几天学习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"

重新启动工程

完美解决。 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值