Sentinel控制台显示服务,但实时监控为空白的情况

发布于 2021-02-28  3408 次阅读


今天在初次使用SpringCloud Alibaba的Sentinel时,出现了Sentinel控制台显示服务,但实时监控为空白的情况。

1.首先访问服务
服务能正常运行,也被注册到了Nacos注册中心

2.查看Sentinel Controller
此时发现服务被检测到,但实时监控为空白。
注意:Sentinel采用懒加载机制,微服务启动后需要先调用所监控的该服务,Sentinel Controller的左侧列表才有在application.yml中指定的服务名

同时CentOS上的Sentinel终端程序在运行中,并一直出现连接超时的错误级别日志

Failed to fetch metric from <http://192.168.3.3:8719/metric?startTime=1614506294000&endTime=1614506300000&refetch=false> (ConnectionException: Connection timed out)
2021-02-28 18:00:36.885 ERROR 6928 --- [pool-2-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.3.3:8719/metric?startTime=1614506301000&endTime=1614506307000&refetch=false> (ConnectionException: Connection timed out)

此时查看控制台的监控列表

果然,IP地址是192.168.3.3,本地地址。所以终端当然会出现连接超时,且控制台实时监控不显示的情况。

3.向微服务的application.yml中添加配置
spring:
cloud:
sentinel:
transport:
clientIp: xxxxxxxxxx
4.重启微服务
此时发现实时监控中出现了曲线图

总结:

在本地连接服务器上的sentinel时,需要手动的设置一下sentinel 连接 dashboard 的客户端ip


一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。