pythoncluster-computingpahomqtt-vernemq

Client connection to VerneMQ cluster


We set up a VerneMQ 3 nodes cluster (https://vernemq.com/docs/clustering/).

The problem is I didn’t find any example on how to connect the clients to the whole cluster.

E.g. for a single VerneMQ instance the client connection (in python) is:

client.connect("xxx.xxx.xxx.xxx", 1883, 60)

where "xxx.xxx.xxx.xxx" is the address of the single instance.
In case of cluster is there a way to specify the address of the whole cluster, instead of pointing a single node?


Solution

  • There is no such thing as the "specific address of the whole cluster". (for VerneMQ and for any other clustered server software).

    If you need a single point of contact, you need a load balancer in front of the cluster. You can then use different load balancing strategies.

    VerneMQ works well with HAProxy for instance and supports the proxy protocol.

    Hope this helps.