1

We are designing an architecture of a high availability distibuted system and we are considering server side vs client side service discovery. There is one problem, I need to solve - how is it possible to discover the Discovery Service (Eureka/Zookeeper/NGINX...)? Is there any way, how not to hardcode/hardconfigure the Discovery Service address?

  • 1
    what did you try so far? – Sazzad Hissain Khan May 21 at 13:29
  • @SazzadHissainKhan I tried to google, but the articles were shallow and assumed, that the Discovery Service address is known. – Michal May 21 at 13:50
4

You've got options.

Bare Metal/Standard Virtual Machines

If you are on bare metal (getting rarer these days, but still common enough in some industries), you can always have an instance of your discovery service on each machine. Since just about all of them handle clustering, you just need to look at localhost for your discovery service.

Dockerization

If docker is handling your "dns" for you, then simply have a docker instance for "discovery".

Environment Variables

You can always inject environment variables to tell your services how to get to the discovery service. Both containers and virtual machines let you do this easily.

Config Server

For non-trivial microservice deployments, it's really common to have a config server. That config server resolves all the parameters so that you can find the discovery service, among other things. NOTE: in this case you would be injecting the URL for the config server so the problem just moved.

Look at your deployment

There are several opportunities to handle the discovery service problem. There very well may be options I haven't listed here.

4

Use environment variables. They've existed for decades and all current (and past) tools support it, including Docker, Kubernetes and the like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.