方法一
eureka服务端设置
eureka:
server:
#关闭保护机制,默认true
enable-self-preservation: false
# 剔除失效服务间隔,默认60000
eviction-interval-timer-in-ms: 3000
client:
healthcheck:
enabled: true
fetch-registry: false
register-with-eureka: false
instance:
#以ip方法注册,docker布署时必须设置为true,否则fegin不能调用
prefer-ip-address: true
eureka客户端
eureka:
instance:
#以ip方法注册,docker布署时必须设置为true,否则fegin不能调用
prefer-ip-address: true
#Eureka服务端在收到最后一次心跳之后等待的时间上限,单位为秒,超过则剔除(客户端告诉服务端按照此规则等待自己)
lease-expiration-duration-in-seconds: 5
Eureka客户端向服务端发送心跳的时间间隔,单位为秒(客户端告诉服务端自己会按照该规则)
lease-renewal-interval-in-seconds: 10
client:
serviceUrl:
defaultZone: http://172.23.62.248:8761/eureka/
方法二
启动容器时加hosts挂载映射
-v C:/Windows/System32/drivers/etc/hosts:/etc/hosts