Recovering Node-RED Flows After Changing Hostname

I recently changed the hostname on my Raspberry Pi and was rather surprised (and initially worried) when the next time I started Node-RED all my flows has disappeared 😱

It turns out that the flows are connected to the computer hostname by their naming convention. Someone even filed a bug regarding this unexpected behavior.

The reason lies in the naming of the configuration files. If you take a look in the .node-red directory you’ll see something like this.

pi@thor:~ $ cd .node-red/
pi@thor:~/.node-red $ ls
flows_raspberrypi_cred.json  lib           package.json       settings.js
flows_raspberrypi.json       node_modules  package-lock.json

Here’s you see two files that both contain the hostname (raspberrypi).

The fix is simple, just rename the files replacing the old hostname with the new hostname.

pi@thor:~ $ mv flows_raspberrypi_cred.json flows_thor_cred.json
pi@thor:~ $ mv flows_raspberrypi.json flows_thor.json

Node-RED will need to be restarted to pick up the new configuration.

pi@thor:~ $ sudo systemctl restart nodered

Join the conversation

1 Comment

Leave a comment

Leave a Reply to jaaz Cancel reply

Your email address will not be published. Required fields are marked *