Hi, I have one node-red app running perfectly in IBM cloud, and I wanted to make it redundant by adding another instance.
I allready know that this would break the flow editor, but this is fine: it is a production app, so the editor is disabled anyway.
When I tried adding instances, I started to receive dupplicate answers to my mqtt messages. Also the DB objects created when I send such message were dupplicated too.
So it looked like the mqtt message I send is not load balanced but dupplicated to both instances.
That is not how it is supposed to be, am I missing something?
EDIT: forgot to mention that I am running the standard node-red boiler plate (NR upgraded to 1.06), on cloud foundry environment.
If you run multiple instances of Node-RED then you have multiple copies of the flows running at the same time.
That's fine for http triggered flows as the platform load balancer will spread the request across the instances.
The same cannot be said for the MQTT nodes. Each instance creates its own connection to the broker and subscribes to its topics. The broker will then send each message to all subscribed clients.
Some brokers do provide a means to load balance, using a particular topic/client id scheme. But it depends what you're using.
OK thanks, I suspected something like this. Not having redundancy is a major issue for me.
I'm using pubsubclient on the device --> IBM IOT platform --> CF node-red and the standard "IBM-iot in" node.
Could you point me to options to have MQTT redundancy? Replacing IBM IOT broker seems like a big break...
If you are using the Watson IoT Platform nodes, I believe they have a checkbox to enable "shared application" mode (I forget what its labelled exactly - been a long time since I've used those nodes as they aren't being maintained anymore). This enables the sort of load balancing you at looking for.
I found indeed some references in the github to something called shared subscription which seem to be exactly that, but old reference from 2015! Somehow I can’t find the settings in the node, I need to dig more.
I am a bit worried to hear you say these nodes are not maintained anymore.
Are there some better nodes to use to connect to IBM IOT platform?
At first I did not see the "shared subscription" option in the ibm iot node config (It is actually called "scalable").
BUT : to enable it on an IBM iot IN node, you can not use the "bluemix service" option. You need to set "API key" and this allows you to define a node config. You just need to enter the API key and token that are in the VCAP services, and then tick "scalable"
I just put a random number in the APP ID.
Works, now the mqtt messages are not dupplicated but load balanced between my instances. .