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注册,