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