title: Spring cloud eureka client to multiple eureka servers
body: <p>I am able to get the eureka server to operate in a peer to peer mode. But one thing I am curious about is how do I get a service discovery client to register to multiple eureka servers.</p>
  
  <p>My use case is this:<br>
  Say I have a service registering to one of the eureka servers (e.g. server A) and that registration is replicated to its peer.  The service is actually pointing at server A.  If server A goes down, and the client expects to renew with server A, how do the renewal work if server A is no longer present.
  Do I need to register with both and if not then how does the renewal happen if the client cannot communicate with server A. Does it have some knowledge of server B (from its initial and/or subsequent comms with A) and fail over to do its registration renewal there?  That is not clear in any of the docs and I need to verify</p>
  
  <p>So based on the answer, I added the following to my application.yml </p>
  
  <pre><code>eureka:
    # these are settings for the client that gets services
    client:
      # enable these two settings if you want discovery to work
      registerWithEureka: true
      fetchRegistry: true
      serviceUrl:
        defaultZone: http://localhost:8762/eureka/, http://localhost:8761/eureka/
  </code></pre>
  
  <p>It only registers to the first in the comma separated list. If I switch them around the registration flips between eureka servers.</p>
  
  <p>I can see that it does separate these based on comma but my guess is that Eureka does not use this underneath (from EurekaClientConfigBean.java)</p>
  
  <pre><code>    @Override
      public List&lt;String&gt; getEurekaServerServiceUrls(String myZone) {
          String serviceUrls = this.serviceUrl.get(myZone);
          if (serviceUrls == null || serviceUrls.isEmpty()) {
              serviceUrls = this.serviceUrl.get(DEFAULT_ZONE);
          }
          if (serviceUrls != null) {
              return Arrays.asList(serviceUrls.split(","));
          }
  
          return new ArrayList&lt;&gt;();
      }
  </code></pre>