Search code examples
microservicesvert.x

How to cluster two microservices running on different servers using vert.x?


suppose I have two microservices ( Service A and service B), now I deploy service A on an aws server and service B on a Digital Ocean server. How can I use vert.x clustering to achieve communication between the two processes using the vert.x event bus. I have been able achieve this when both services are running on the same machine.One of the solutions I could come up with was this:-

Run a hazlecast clustering service separately on a separate machine and configure service A and service B so that they connect to the common clustering service( when I say service, it could just be the hazlecast service running through the command line), if there are better ways to achieve this, please do suggest them.


Solution

  • Hazelcast has different plugins for discovery within a single cloud. But for multicloud I believe your only resort is to hardcode the node IP addresses:

    <network>
        <join>
            <multicast enabled="false">
            </multicast>
            <tcp-ip enabled="true">
                <member>aws-host</member>
                <member>digitalocean-host</member>
            </tcp-ip>
        </join>
    </network>