从spring文档中,我看到我们可以一起拥有对等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?
谢谢
发布于 2015-06-16 01:26:27
在eureka.client.serviceUrl.defaultZone
中使用逗号分隔的对等点列表。
eureka.client.serviceUrl.defaultZone=http://<peer1host>:<peer1port>/eureka,http://<peer2host>:<peer2port>/eureka
https://stackoverflow.com/questions/30850232
复制相似问题