server:
port: 8081
eureka:
instance:
hostname: localhost
#实例转化id
prefer-ip-address: true
client:
registerWithEureka: false
#要不要去注册中心获取其他服务的地址
fetchRegistry: true
serviceUrl:
defaultZone: http://localhost:8080/eureka/
prefer-ip-address: true:这个必须有,有这个配置可以配置不同hostname.
同事hosts中需配置域名跟ip的对应关系 否则会出现只注册最后一个Eureka 的问题
或者 Eureka 集群都用IP
server:
port: 8081
eureka:
instance:
hostname: localhost
#实例转化id
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://127.0.0.1:8080/eureka/
Eureka Client 调用注册到集群:用英文逗号隔开
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8081/eureka/,http://localhost:8080/eureka/