Interaction between NodeRED instances?

Hallo,

I'm running 2 instances of NodeRED on NGINX in docker. One on port 1880, other on 1882.
There are some events which I'd like to share from one instance to the other.

What is the best way to do this?

Kind regards,
Peter Hunt.

1 Like

How about using MQTT to send msgs between the two.

Node-RED has many ways of intercommunicating. A message queue like MQTT is indeed one of the best. However, you can use the websocket, tcp, udp and http nodes depending on needs.

Thanks both. MQTT was the first thing I thought of. Either my friend who maintains the server has blocked this interaction, or my NodeRED config is faulty.

Could you please share an example of how to set up the config on both sides? If I still can't manage to get it working we will need to check settings server side...

First you need an MQTT broker (mosquitto is my choice), then the two systems can connect to that broker using mqtt in and out nodes, and subscribe and/or publish to topics that both know about.

Since you are using Docker, you will need to make sure that the correct port(s) are open to allow traffic to move between the different Docker containers.

Yes, I missed the reference to Docker.

@hunter are you using Docker for a reason? If you don't have a good reason then don't do it, it just adds complexity.

Just thought I'd chime in, as I use node-red in Docker as that has proved to be the only way to make it work on some Moxa UC-8100 units we use which are limited to Debian 9. If I remember correctly, there was some Python dependency that doesn't work by default.

dependency to what?

Node-RED and Mosquito do not need python.

Some nodes, that get compiled may need python - but not the core Node-RED nodes and not mosquito MQTT broker.

1 Like

It may have been some extra nodes that we use (modbus, buffer parser, dashboard, serial port, etc.) ; it's been a few months since I sorted setup scripts. Python3 is typically installed as a dependency. It works in general.

I am not sure that this has any relevance to @Hunter's problem.

If using docker then I would use docker compose to create the instances together with a broker as that will make networking easier as you can just use the instance name to resolve the broker .

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.