记录consul注册服务的错误

1、consul启动到管理页面时,出现一个Service Checks = false

这个是由于actuator/health无法检测,因为项目中的consul需要检测服务的健康状态。

可以使用 http://localhost:8500/v1/agent/checks 查看你的consul中各个服务的情况,直接定位到带错误的服务就可以。

我是直接指定spring.cloud.consul.discovery.health-check-url

属性为:http://${spring.cloud.consul.host}:${server.port}/actuator/health

${spring.cloud.consul.host} =》获取当前consul的主机ip,就是你配置的

${server.port} =》当前服务的端口

server:
  port: 8006

spring:
  application:
    name: consul-payment-service
  cloud:
    consul:
      host: 127.0.0.1
      port: 8500
      discovery:
        health-check-url: http://${spring.cloud.consul.host}:${server.port}/actuator/health
        service-name: ${spring.application.name}

2、通过服务提供者的服务id访问不到报No instances  avalable for   服务名称

我添加了以下配置(网友的解释是,consul默认用hostname注册,

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值