从春季文档中,我看到我们可以一起拥有对等eureka服务器,因此对于Eureka1,在application.yml中,我可以拥有:
spring: profiles: peer1 eureka: instance: hostname: peer1 client: serviceUrl: defaultZone: http://peer2/eureka/
在Eureka Server 2中,我可以拥有:
spring: profiles: peer2 eureka: instance: hostname: peer2 client: serviceUrl: defaultZone: http://peer1/eureka/
现在,这两个eureka服务器相互了解,这很好。但是,现在在配置客户端时,当他们再次注册Eureka时,该怎么做?
在我的客户应用程序中,我有:
eureka: instance: hostname: ${host.instance.name:localhost} nonSecurePort: ${host.instance.port:8080} leaseRenewalIntervalInSeconds: 5 #default is 30, recommended to keep default metadataMap: instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}} client: serviceUrl: defaultZone: http://(eurekaServerHost):8761/eureka/ server: port: ${host.instance.port:8080}
所以现在我的问题是我应该在客户端application.yml中使用peer1还是peer2作为EurekaServerHost?