6

I am implementing a service discovery and I evaluating two options: Eureka and Consul.

Help me decide! I am leaning towards Eureka, but I need to clear a main tech problem. My infrastructure is based on openshift. I can have multiple containers running Eureka Servers behind a load balancer. As far as I know each server needs to communicate with each other. Also, Eureka is mainly used with AWS...

(newbie) Question:

1) How can I configure each Eureka Server to communicate with each other? I have a single (load balanced) URL. My fear is that each server potentially may become desynchronized.

2) Am i missing something?

guilhermecgs
  • 2,913
  • 11
  • 39
  • 69

2 Answers2

2

You're right, each of the Eureka Server must communicate with each other. You can also play with regions depending on your approach.

To make it work (without zones), you must configure the property:

eureka.client.service-url.defaultZone: http://1st-eureka-server-ip-or-hostname:port/eureka/,http://2nd-eureka-server-hostname:porta/eureka/

The configuration above accepts a comma-delimited set of IP/hostname of all the Eureka Servers.

If you want to have a multi-zone configuration, I recommend you to read this blog post.

Marcos Barbero
  • 1,101
  • 8
  • 14
1

To Configure each Eureka Server to communicate with each other try this way to make a diffrent diffrent zone in resource in folder.

application-zone1.yml

server.port: 8001
eureka:
  instance:
    hostname: localhost
    metadataMap.zone: zone1

application-zone2.yml

 server.port: 8002
eureka:
  instance:
    hostname: 127.0.0.1
    metadataMap.zone: zone2

application.yml

  client:
    register-with-eureka: false
    fetch-registry: false
    region: region-1
    service-url:
      zone1: http://localhost:8001/eureka/
      zone2: http://127.0.0.1:800/eureka/
    availability-zones:
      region-1: zone1,zone2
spring.profiles.active: zone1

Follow this tutorial

Sonu patel
  • 353
  • 1
  • 8