Fallback Eureka Server Configuration for Discovery Clients?

650 Views Asked by At

Most of the Eureka client configurations I have seen look like this:

eureka:  
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

Is it possible to configure alternate zones, such that if the default fails the client switches over to the alternate? Also is it possible to use hystrix as a circuit breaker to switch over to an alternate Eureka instance?

1

There are 1 best solutions below

1
On BEST ANSWER

ServiceUrl is a map. Each entry is for a different zone (defaultZone is the default zone).

eureka:  
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
      zoneA: http://localhost:8761/eureka/
      zoneB: http://localhost:8761/eureka/

For failover, you set a comma separated list as the value, eg.

eureka:  
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/, http://localhost:8762/eureka/

Hystrix is not a load balancer, so that doesn't make sense and isn't supported.