服务器上分别配置了eth0, eth1两块网卡,只有eth1的地址可供其它机器访问,eth0IP 无效。在这种情况下,服务注册时Eureka Client会自动选择eth0作为服务ip, 导致其它服务无法调用。

 

 

--注意:仅列出解决问题的配置项

yml格式

spring:
  cloud:
    inetutils:
      ignored-interfaces: eth0  # 让应用忽略eth0网卡

eureka:
  instance:
    hostname:  # 主机ip地址
    prefer-ip-address: true # 注册时使用用ip而不是主机名称

 

properites格式:

spring.cloud.inetutils.ignored-interfaces[0]=eth0 # 忽略eth0网卡, 支持正则表达式  

# 指定此实例的ip
eureka.instance.ip-address=
# 注册时使用ip而不是主机名
eureka.instance.prefer-ip-address=true

相关文章:

  • 2021-10-25
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-05-24
  • 2022-12-23
  • 2021-08-06
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-09-25
  • 2021-12-09
相关资源
相似解决方案