zoukankan      html  css  js  c++  java
  • SpringCloud Eureka: 使用真实IP 多网卡选择

    服务器上分别配置了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
  • 相关阅读:
    函数之返回值
    函数之初识函数
    三元运算符
    枚举enumerate
    模块
    迭代器
    斐波那契
    leetcode155 最小栈
    leetcode94 二叉树的中序遍历
    leetcode20 有效的括号
  • 原文地址:https://www.cnblogs.com/arebirth/p/springcloudeurekatrueipadd.html
Copyright © 2011-2022 走看看