【sentinel】控制台发送心跳包报错(九)

前言

转载:https://www.jianshu.com/p/8ecb898ef315
sentinel控制台发送心跳包报错:

2020-07-30 13:40:57.720 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087648000&endTime=1596087654000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:04.718 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087655000&endTime=1596087661000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:11.719 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087662000&endTime=1596087668000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:18.719 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087669000&endTime=1596087675000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:25.718 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087676000&endTime=1596087682000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:32.718 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087683000&endTime=1596087689000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:39.732 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087690000&endTime=1596087696000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:46.730 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087697000&endTime=1596087703000&refetch=false> (ConnectionException: Connection refused: no further information)
2020-07-30 13:41:53.728 ERROR 19940 --- [pool-4-thread-1] c.a.c.s.dashboard.metric.MetricFetcher   : Failed to fetch metric from <http://192.168.17.46:8725/metric?startTime=1596087704000&endTime=1596087710000&refetch=false> (ConnectionException: Connection refused: no further information)

解决办法

解决办法:
sentinel-transport-simple-http依赖换成sentinel-transport-netty-http包

<dependency>
    <groupId>com.alibaba.csp</groupId>
    <artifactId>sentinel-transport-netty-http</artifactId>
    <version>x.y.z</version>
</dependency>

测试

首先,在没修改依赖前,可以修改下jnm启动时,心跳端口和心跳周期。这样可以清楚的看到当前调试的项目报错信息。
然后替换依赖,重启项目,就可以看到,控制台之前显示的错误日志已经没了。
配置如下:

  • 本地启动 HTTP API Server 的端口号(就是当前服务的心跳地址端口)
    -Dcsp.sentinel.api.port=8206
  • 心跳包发送周期,单位毫秒
    -Dcsp.sentinel.heartbeat.interval.ms=2000

总结

因为我这边是有多个服务,我修改这个问题的时候,先是修改了两个服务。这时候发现,修改过的这两个服务没有再显示心跳包的报错信息了,只有第三个没有修改的依然在提示。
但是我设置的心跳间隔是两秒1次,这个报错的信息却是6秒1次(可以参考最上面的控制台日志信息)。所以可以知道,控制台发送心跳是一个一个发的

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sentinel 控制台是一个基于 Spring Cloud 的应用,它提供了一个可视化的界面来管理和监控 Sentinel 的流控规则、降级规则、系统规则等。而 Nacos 是一个开源的注册中心和配置中心,它提供了服务注册、配置管理和服务发现等功能。将 Sentinel 控制台持久化到 Nacos 可以实现对 Sentinel 控制台配置的动态管理和版本控制。 将 Sentinel 控制台持久化到 Nacos,需要进行以下步骤: 1. 在 Nacos 控制台中创建一个命名空间和配置集,用来保存 Sentinel 控制台的配置信息。 2. 在 Sentinel 控制台的 application.properties 配置文件中,添加以下配置: ``` # 配置 Nacos 的服务地址和命名空间 spring.cloud.nacos.config.server-addr=<Nacos 服务地址> spring.cloud.nacos.config.namespace=<Nacos 命名空间> # 配置 Sentinel 控制台的配置信息 spring.cloud.sentinel.transport.dashboard=localhost:8080 management.endpoints.web.exposure.include=sentinel spring.cloud.sentinel.eager=true ``` 3. 在 Sentinel 控制台启动后,访问 http://localhost:8080/nacos/config 会自动将 Sentinel 控制台的配置信息保存到 Nacos 中。 4. 在 Nacos 控制台中修改 Sentinel 控制台的配置信息,可以实现对 Sentinel 控制台配置的动态管理和版本控制。 需要注意的是,将 Sentinel 控制台持久化到 Nacos 需要使用 Sentinel 控制台的 1.8.0 版本及以上,同时需要安装 Nacos 的配置中心服务。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值