Sentinel部署报错Failed to fetch metric 问题解决

前言:使用docker部署的微服务在连接sentinel一直显示连接超时,错误如下

Failed to fetch metric from <http://42.192.139.**:3002/metric?startTime=1647926670000&endTime=1647926676000&refetch=false> 
(ConnectionException: Connection timed out)

bootstrap.yaml文件配置sentinel,配置如下

server:
  port: 3001
spring:
    sentinel: #配置sentinel
      transport:
        dashboard: 106.13.27.**:8179  #指定sentinel dashboard web 地址
        clientIp: 42.192.139.** #指定和控制台通信的IP,若不配置,会自动选择一个IP注册
        port: 3002  #指定sentinel组件与sentinel dashboard组件通信地址8719

解决思路:

1、先将服务部署在云服务器上,比对是否docker容器对服务(3002)端口隔离了

2、开通(3002)防火墙的端口,云服务上的(3002)端口也放开

3、发现这样sentinel竟然能够正常监控到,于是就在docker启动命令上暴露连接sentinel端口,问题解决

总结:

1)bootstrap.yaml配置clientIp要指定服务器外网Ip,不然sentinel会对服务内网Ip进行连接

2)不同服务需要切换bootstrap.yaml配置sentinel的port端口,否则会通通都默认连接服务器的8179端口

 

posted @   市井丛林  阅读(3534)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示