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是指定的地址,缺一不可。

posted @ 2020-09-01 16:52  小小tree  阅读(1706)  评论(0)    收藏  举报