apollo配置中心注册到eureka指定ip而不是hostName


@

【转载】原文章地址为:https://blog.csdn.net/walh131458/article/details/106075226

adminserver的bootstrap.xml配置

eureka:
  instance:
    hostname: 192.168.1.1
    preferIpAddress: true
    status-page-url-path: /info
    health-check-url-path: /health
    instance-id: 192.168.1.1:8090
    prefer-ip-address: true
    ip-address: 192.168.1.1
  client:
    serviceUrl:
      defaultZone: http://192.168.1.1:8080/eureka/
    healthcheck:
      enabled: true
    eurekaServiceUrlPollIntervalSeconds: 60

management:
  health:
    status:
      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP 

configserver的bootstrap.xml配置

eureka:
  instance:
    hostname: 192.168.1.1
    preferIpAddress: true
    status-page-url-path: /info
    health-check-url-path: /health
    instance-id: 192.168.1.1:8080
    prefer-ip-address: true
    ip-address: 192.168.1.1
  server:
    peerEurekaNodesUpdateIntervalMs: 60000
    enableSelfPreservation: false
  client:
    serviceUrl:
      defaultZone: http://192.168.1.1:8080/eureka/
    healthcheck:
      enabled: true
    eurekaServiceUrlPollIntervalSeconds: 60

management:
  health:
    status:
      order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP

特别注意

	instance-id: 192.168.1.1:8080
    prefer-ip-address: true
    ip-address: 192.168.1.1

这三个配置项需要特别注意,instance-id是客户端注册到eureka的地址,prefer-ip-address和ip-address是指定的地址,缺一不可。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM