My question is related to microservices & service discovery of a service which is spread between several hosts.
The setup is as follows:
- 2 docker hosts (host A & host B)
- a Consul server (service discovery)
Let’s say that I have 2 services:
- service A
- service B
Service B is deployed 10 times (with random ports): 5 times on host A and 5 times on host B.
When service A communicates with service B, for example, it sends a request to serviceB.example.com (hard coded).
In order to get an IP and a port, service A should query the Consul server for an SRV record.
It will get 10 ip:port pairs, for which the client should apply some load-balancing logic.
- Is there a simpler way to handle this without me developing a client resolver (+LB) library for that matter ?
- Is there anything like that already implemented somewhere ?
- Am I doing it all wrong ?