Does assigning a new IP cause all flows to be lost?

Since rebooting my laptop and router after a powerfail - I have lost all my flows and dashboard.

I searched this forum and google found nothing that points to loss due to new ip assignment.
Found some info when server/machine name is changed.

I searched all .json files under the .node-red folder (windows 10) but nothing refers to the old ip address.
laptop name remains the same.

Settings file is original - not changed at all.

I have now assigned/reserved a static ip address (different from before) which is outside the dhcp range.

Any suggestions on how I can recover my flows and the dashboard?
Thanks

What files do you see in your .node-red folder? Show us a directory listing please. Include hidden files, if Windows normally hides those.

1 Like

hi @MoJeeza

by default, Node-RED includes the hostname in the name of the flow file it uses. If you change hostname (or IP, as you have done), then it'll be looking for a different file than the one you have.

This is why Colin asked to see what files you have.

If you look in the ~/.node-red directory you should see a file call flows_XYZ.json and flows_XYZ_cred.json - where XYZ is the old hostname.

When NR starts up it logs the name of the flow file it is trying to use. The quick fix is to rename the flow file to match that - replacing the XYZ part of the name - be sure to rename the _creds.json file as well.

1 Like

@Colin Thanks for your reply...my issue is resolved - don't know what I did to resolve it but one of the things I did was reboot again and make sure the Mac address I used to reserve my fixed IP was the Physical address of the wireless lan adapter Wi-Fi for the laptop not the virtual ones that VirtualBox adapter uses.
So, I'm back in business.
I made sure I saved first all contents of the ./node-red folder before I did anything...that was a lot of work I put into those flows and the dashboard. :relieved:

@knolleary Greatly appreciate you following up with details to reply from @Colin
Thanks guys.

Now I regularly export to my own folder inside library as Json formatted file - for any changes I make.

I'm learning as I go along...

If you use the projects feature (or manually use git to archive your files if you prefer) then you can always recover the latest or earlier versions of the files. If you use github for your repository (they provide free repositories for free now) then even if your system goes up in smoke you will still be able to recover the files.

@Colin I am on Git, in-fact I login to node-red site using git credentials.
That is an awesome feature you mention. I should look up how to do this. I'm just getting back into node-red after a very long break.
Thanks.

So the answer to the Question: No, it does not....but better to have a static IP for the machine that runs the NR Server.

Out of interest, what were the names of the old and new flow files? I knew the name would change with host name, but I didn't realise the ip address would change it.

On some dhcp systems, the hostname gets generated as something like dhcp-192-168-1-2 - ie, including the IP in the generated hostname.

I can't remember the exact circumstances it does that... been way too long since I've last had to deal with dhcpd and such.

Ah, that would explain it, I have never seen that as far as I can recall

@Colin

Names of none of the files had changed. Only the IP had changed.

image

So it wasn't that node red was picking up a different flows file.
When it was failing, what exactly was the symptom you were seeing? When you said you had lost all your flows I (and I think others) assumed that node-red was running normally but, in the editor, all the flows were empty.

I don't think we know that from the screenshot.

And given everything else @MoJeeza has said that points 100% at this being the issue, I don't see why there's a need to go looking for another explanation.

The only way to be sure would be to check the startup log of NR where it reports the exact flow file it is trying to use and to compare that with the files that are actually there.

There isn't a flows file whose name includes an ip, so unless the hostname was changed and has now changed back again then I don't understand what happened. I always like to understand a problem. However it is obviously up to @MoJeeza whether he is concerned or not. I was wondering whether the symptom actually seen was an inability to access node-red at all rather than an apparently empty flows file.

1 Like

unless they actually created a new flow and deployed it (to save it) there would not be a new file.

True, but if there system was including the ip address in the host name then I would have expected to see that in flows file name. Unless it only does that in certain circumstances.

it may not be the ip address - it maybe the domain... eg my mac has been known to give me hostname DCJmac.lan and/or DCJmac.uk.ibm.com don't sweat it. it can happen.

Gentlemen: Unfortunately, I did not know enough about node-red at the time, to have looked deeply into the cause and to look at the log.

To clarify - there was no change in the name of the laptop - just a new IP had been assigned.

So before the power fail, I was working on one flow and 4 others were disabled.
When power was restored - I started the node-red server from command prompt by typing node-red.
I did not pay attention at the messages - went to the url that I usually type: http://192.168.0.26:1880
and I saw a blank flow (empty editor).

So started googling for solutions...at the time, I did not realize a new IP had been assigned the the laptop.

All my google results indicated only change in name would cause this and that the filenames had the server name embedded in them. Knowing that I had not changed the name I thought of posting the Q on this forum about effect of IP change to loss of workflows.

So as a lesson learnt - I decided to assign a fixed IP address to my laptop - and there too I overlooked one issue - I used a virtual mac address (assigned by VirtualBox) and not the mac add from the physical adapter. Once that was sorted out, I had a working fixed address.

Also in the mean time, I had saved the contents of ".node-red" folder. By this time, I had opened one of the json files and found that my flows were indeed there.

After assigning a fixed address, I rebooted the laptop again and re-started the node-red and using the new IP address in the url, I was happily surprised to see my environment restored...

I also assigned in the hosts file: a name to the new fixed IP address - same name that I have assigned "W10SSD" that was embeddef in files under .node_red folder (my laptop name)

Now let's look at the following trail...

C:\Users\mohsi.node-red>node-red
20 Apr 01:54:07 - [info]

Welcome to Node-RED

20 Apr 01:54:07 - [info] Node-RED version: v1.0.5
20 Apr 01:54:07 - [info] Node.js version: v10.15.3
20 Apr 01:54:07 - [info] Windows_NT 10.0.18363 x64 LE
20 Apr 01:54:08 - [info] Loading palette nodes
20 Apr 01:54:09 - [info] Dashboard version 2.14.0 started at /ui
20 Apr 01:54:10 - [info] Settings file : \Users\mohsi.node-red\settings.js
20 Apr 01:54:10 - [info] Context store : 'default' [module=memory]
20 Apr 01:54:10 - [info] User directory : \Users\mohsi.node-red
20 Apr 01:54:10 - [warn] Projects disabled : editorTheme.projects.enabled=false
20 Apr 01:54:10 - [info] Flows file : \Users\mohsi.node-red\flows_W10SSD.json
20 Apr 01:54:10 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

20 Apr 01:54:10 - [info] Starting flows
20 Apr 01:54:10 - [info] Started flows
20 Apr 01:54:10 - [info] Server now running at http://127.0.0.1:1880/
20 Apr 01:54:10 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:12:29 - [info] Stopping flows
20 Apr 02:12:29 - [info] serial port COM5 closed
20 Apr 02:12:29 - [info] Stopped flows
20 Apr 02:12:29 - [info] Starting flows
20 Apr 02:12:29 - [info] Started flows
20 Apr 02:12:29 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:15:09 - [info] Stopping flows
20 Apr 02:15:09 - [info] serial port COM5 closed
20 Apr 02:15:09 - [info] Stopped flows
20 Apr 02:15:09 - [info] Starting flows
20 Apr 02:15:09 - [info] Started flows
20 Apr 02:15:09 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:15:38 - [info] Stopping flows
20 Apr 02:15:38 - [info] serial port COM5 closed
20 Apr 02:15:39 - [info] Stopped flows
20 Apr 02:15:39 - [info] Starting flows
20 Apr 02:15:39 - [info] Started flows
20 Apr 02:15:39 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:16:47 - [info] Stopping flows
20 Apr 02:16:47 - [info] serial port COM5 closed
20 Apr 02:16:47 - [info] Stopped flows
20 Apr 02:16:47 - [info] Starting flows
20 Apr 02:16:47 - [info] Started flows
20 Apr 02:16:47 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:31:38 - [info] Stopping flows
20 Apr 02:31:38 - [info] serial port COM5 closed
20 Apr 02:31:38 - [info] Stopped flows
20 Apr 02:31:38 - [info] Starting flows
20 Apr 02:31:38 - [info] Started flows
20 Apr 02:31:38 - [info] serial port COM5 opened at 115200 baud 8N1
20 Apr 02:36:14 - [info] Stopping flows
20 Apr 02:36:14 - [info] serial port COM5 closed
20 Apr 02:36:14 - [info] Stopped flows
20 Apr 02:36:14 - [info] Starting flows
20 Apr 02:36:14 - [info] Started flows
20 Apr 02:36:14 - [info] serial port COM5 opened at 115200 baud 8N1
21 Apr 11:33:12 - [info] Stopping flows
21 Apr 11:33:12 - [info] serial port COM5 closed
21 Apr 11:33:12 - [info] Stopped flows
Terminate batch job (Y/N)? y

C:\Users\mohsi.node-red>node-red
21 Apr 11:33:44 - [info]

Welcome to Node-RED

21 Apr 11:33:44 - [info] Node-RED version: v1.0.5
21 Apr 11:33:44 - [info] Node.js version: v10.15.3
21 Apr 11:33:44 - [info] Windows_NT 10.0.18363 x64 LE
21 Apr 11:33:45 - [info] Loading palette nodes
21 Apr 11:33:47 - [info] Dashboard version 2.14.0 started at /ui
21 Apr 11:33:48 - [info] Settings file : \Users\mohsi.node-red\settings.js
21 Apr 11:33:48 - [info] Context store : 'default' [module=memory]
21 Apr 11:33:48 - [info] User directory : \Users\mohsi.node-red
21 Apr 11:33:48 - [warn] Projects disabled : editorTheme.projects.enabled=false
21 Apr 11:33:48 - [info] Flows file : \Users\mohsi.node-red\flows_W10SSD.json
21 Apr 11:33:48 - [info] Server now running at http://127.0.0.1:1880/
21 Apr 11:33:48 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

21 Apr 11:33:48 - [info] Starting flows
21 Apr 11:33:48 - [info] Started flows
21 Apr 11:33:48 - [info] serial port COM5 opened at 115200 baud 8N1

At 11:33:12 - the server was not responding (so I thought)...because I was trying to connect using the normal IP address based url.

This morning, I can no longer access the editor or ui using the ip based url:
192.168.0.42:1880

I have to use the name:
w10ssd:1880 and w10ssd:1880/ui

Last night it worked perfectly:

Nothing has changed since last night.

For me that is not an issue but just thought I'd add it to the discussion.

I also checked the entire windows registry - node-red does not store the ip address there (or at least I could not find it).

Are you sure the machine has the IP 192.168.0.42? What do you see if you run
ping w10ssd