1.Consul
图中consumer的 check报错: TTL expired
如果该模块此前从未成功注册到该consul,报错信息形式如下
Get “http://ip-address:port/actuator/health”: dial tcp: lookup ip-address on 100.100.2.138:53: no such host
其中ip-address是微服务(如consumer)所在的host地址


解决方法是在consumer 的配置文件中加入心跳协议:
server:
port: 80
spring:
application:
name: consul-consumer-order
cloud:
consul:
host: xxx.xxx.xxx.xxx # consul所在host的ip地址
port: 8500
discovery:
service-name: ${spring.application.name}
# 添加以下两个设置
heartbeat:
enabled: true
prefer-ip-address: true
2.Hystrix
我们知道,IntelliJ IDEA配置的热部署对Java代码的改动,过一会儿会自动Rerun。
但是对注解@HystrixCommand内属性的修改, 建议手动重启微服务。
本文介绍了解决Consul中consumer模块注册失败的问题方法,并提到了配置心跳协议的具体步骤。此外还讨论了IntelliJ IDEA热部署对@HystrixCommand注解的影响,建议手动重启微服务以确保更改生效。
168万+

被折叠的 条评论
为什么被折叠?



