I am prototyping a Spring Cloud + Netflix OSS application suite and have run into problems with Eureka. In our installation, we have Spring Cloud Config Server + Eureka Server, and then 2 modules that use this server component to bootstrap and discover services.
The problem that I am facing is that if I distribute two instances of the Eureka server and try to connect them (based on Two Peer Aware Eureka Servers in Documents ), they do not synchronize with each other. See Configs below and / or the code on GitHub .
Essentially, Peer1 starts up and looks great. Peer2 will start and look normal, with both peers showing each other in services. However, if the UserService module is twisted and registered with Peer1, Peer2 will never see it. If we then deploy the "Web" module pointing to Peer2, it will never be able to solve the UserService. They mainly act in isolation.
I tried several combinations of setting serviceUrl both on the server and on the Eureka server instance, but to no avail. Am I just setting something up wrong?
Peer 1 / default config:
server: port: 8888 eureka: dashboard: path: /dashboard instance: hostname: peer1 leaseRenewalIntervalInSeconds: 3 client: serviceUrl: defaultZone: ${eureka.server.serviceUrl:http://localhost:${server.port}/eureka/} server: serviceUrl: defaultZone: http://localhost:${server.port}/eureka/ peer2: http://peer2/eureka/ waitTimeInMsWhenSyncEmpty: 0 spring: application: name: demo-config-service profiles: active: native # required for Spring Cloud Bus rabbitmq: host: ${DOCKER_IP:192.168.59.103} port: 5672 username: guest password: guest virtualHost: / cloud: config: server: prefix: /configs native: searchLocations: /Users/dave/workspace/oss/distributed-spring/modules/config-server/src/main/resources/testConfigs
Peer-to-peer network configuration:
server: port: 8889 eureka: dashboard: path: /dashboard instance: hostname: peer2 leaseRenewalIntervalInSeconds: 3 client: serviceUrl: defaultZone: ${eureka.server.serviceUrl:http://localhost:${server.port}/eureka/} server: serviceUrl: defaultZone: http://localhost:8888/eureka/ peer1: http://peer1/eureka/ waitTimeInMsWhenSyncEmpty: 0 spring: application: name: demo-config-service profiles: active: native # required for Spring Cloud Bus rabbitmq: host: ${DOCKER_IP:192.168.59.103} port: 5672 username: guest password: guest virtualHost: / cloud: config: server: prefix: /configs native: searchLocations: /Users/dave/workspace/oss/distributed-spring/modules/config-server/src/main/resources/testConfigs
source share