Distributed Node-RED (DNR) Editor
Node-RED is a visual tool for wiring the Internet of Things. The Distributed Node-RED (DNR) project extends Node-RED to support flows that can be distributed between devices. DNR works with a cluster of vanilla Node-RED instances and a coordinator called DNR Editor is used to coordinate the participating Node-RED instances.
DNR Editor is a Node-RED flows editor modified to support the design of distributed flows. Once new flows are deployed, they are not started but distributed to participating Node RED instances in the cluster and deployed there.
A Node RED instance can be connected to a DNR cluster by installing node-red-contrib-dnr, a special Node RED node designed for DNR.
Node-red-contrib-dnr module consists of a special node called DNR Daemon node, which acts as a local agent that connects the local Node-RED instance to the DNR cluster. This node gets the DNR flows from DNR Editor, transforms it to a compatible Node-RED flow and deploys the "dnr-ized" flow to the local Node-RED instance.
A sample DNR flow that runs on several Raspberry Pis and a Cloud server:
The idea of DNR:
- every device has a capability/property definition such as storage, memory or geographic location.
- a Node-RED node can be configured so that it only run on certain devices by defining one or more constraints assocciate to it. The constraints will be matched against the device's capability/property definition.
- if a node is not to be run on a device due to the device not meeting the required constraints, messages that are sent to it will be intercepted and finally dropped, or redirected to an external Node RED instance.
- mechanism for all participating devices to download the distributed flow from a 'DNR Operator' (where run dnr-editor) such as a cloud server.
Requirements: several Raspberry Pi (participating Node-RED, just for fun, could be multiple instances of Node-RED in a single machine); a computer to run DNR Editor (the coordinator)
Setup DNR Editor
Similar to Node-RED: git clone, npm install, grunt build, and start by "node red"
Or just: npm install -g dnr-editor, dnr-editor -s <setting file>
DNR Editor will run by default at :1818 port.
Connect Node RED to the cluster:
- For each Node RED instance, install node-red-contrib-dnr nodes: either using GUI->Menu->Manage Pallete->Install or go to ~/.node-red and do npm install node-red-contrib-dnr
- Getting the Seed flow: go to DNR Editor at http://localhost:1818, GUI->Menu->DNR->Export DNR Seed->Export to clipboard
- Import the Seed flow on each participating Node RED: GUI->Import->Clipboard->Paste(CMD/CTRL V)->Import
- Configure the imported Seed flow: configure the DNR Editor's target (so that the daemon can connect to) and local Node RED's informration (credentials if local Node RED is password protected, device's name, and possibly location)
- Deploy the Seed flow: click Deploy.
After this, these connected devices can be seen on the Device Monitor on DNR Editor: GUI->Menu->DNR->Show devices
A minimal sample DNR flow:
Documentation on vanilla Node-RED can be found here.
More tutorials on wiki page.
An initial version of DNR is also available at https://github.com/mblackstock/node-red-contrib/ and at https://github.com/namgk/distributed-node-red where a single installation of modified Node-RED run on participating devices. In order to reduce the effort required to augment the vanilla Node-RED as well as to allow users to use vanilla Node-RED instead of an augmented one, a special node is created called DNR-Daemon (node-red-contrib-dnr) which downloads, converts DNR flows into flows that vanilla Node-RED can understand, and install them to the local vanilla Node RED where it run.
Node-RED is a project of the JS Foundation.
It was created by IBM Emerging Technology.
This is a research project funded by NSERC that aims at designing a distributed application platform for the Internet of Things and Fog Computing.