soaservice-discoveryautodiscovery

How can two services discover each other without static addresses?


Supposed I have two services that need to share and / or exchange data. Both instances are separate from each other, and they shall not know anything about where the other part is located.

Now in order for them to be able to share and / or exchange data, they need to connect to each other.

How do they find each other without the need to configure the IP addresses explicitly? In other words: How could they detect each other automatically?

Basically, I have two ideas:

Any idea of how I could solve this in an intelligent way?

PS: If you want to say so, I'm looking for a way to handle dynamic IPs without the need for a central DNS server.


Solution

  • The usual way is to have some fault-tolerant server where services register and can then look for other services - Curator framework implements that over zookeeper.

    If you want autodiscovery then you should probably implement some sort of gossip protocol so that the servers would know which other servers are out there in a reliable way. You should keep in mind that getting gossip protocols right is tricky (e.g. some of past Amazon cloud failures where due to problems in their implementation)