Welcome to All.
How to disable writing global.json.<13-digit number>.tmp files beside global.json into /.node-red/context/global directory?
Best Regards
Hi @rzajac03
It is not possible to disable writing those files. To avoid corruption, the file persistence for context writes its data to a tmp file, then copies over the actual file.
Why do you want to disable this behaviour?
Hi knolleary
Every 30 seconds writing of this *.tmp file consume the same amount of memory like global.json file, which is overwritten. I have plenty of *.tmp files - I suposse only last is used.
Do you mean that the .tmp files are not getting removed automatically? If so can you do an ls -al
of the context folder and show us? Copy/paste the result please, not screenshot.
Edit: Also please start node-red in a command window and post the output seen. Leave it running long enough for a context write to occur.
Hello Colin
These are after ls -la:
rpizero-2@raspberrypi:~ $ cd /home/rpizero-2/.node-red/context/global
rpizero-2@raspberrypi:~/.node-red/context/global $ ls -la
total 12
drwxr-xr-x 2 rpizero-2 rpizero-2 4096 04-07 11:58 .
drwxr-xr-x 4 rpizero-2 rpizero-2 4096 04-07 10:45 ..
-rw-r--r-- 1 rpizero-2 rpizero-2 180 04-07 11:58 global.json
rpizero-2@raspberrypi:~/.node-red/context/global $ cd
rpizero-2@raspberrypi:~ $ cd /home/rpizero-2/.node-red/context
rpizero-2@raspberrypi:~/.node-red/context $ ls -la
total 16
drwxr-xr-x 4 rpizero-2 rpizero-2 4096 04-07 10:45 .
drwxr-xr-x 6 rpizero-2 rpizero-2 4096 04-07 15:02 ..
drwxr-xr-x 2 rpizero-2 rpizero-2 4096 04-07 11:58 a2051b3951a2e934
drwxr-xr-x 2 rpizero-2 rpizero-2 4096 04-07 11:58 global
rpizero-2@raspberrypi:~/.node-red/context $
Almost all global.json.<13-digit number>.tmp files are 966 byte but when I've open it (with Geany or Notepad looks empty. Some of global.json.<13-digit number>.tmp files are 0 bytes. Global.json file was all the time 966 bytes but last is 180 bytes because I have suddenlly disabled writing to memory in settings.json file, but its content is right.
Best Regards
Your ls
command is not showing the .tmp files, so I am confused about exactly what you are saying.
But I am surprised to find on on of my systems that I do have numerous .tmp files, but they are all old. Are you using an old version of node-red? If you think not then show us the node-red startup log please. You should be able to see that using
node-red-stop
node-red-start
Hello Colin
I have tried to delete all files, from yesterday, from directory /context/global but I have received message: Files and directory doesn't exists. But they still exists (are visible) in that directory. Only global.json file (180 bytes) was moved to the trash.
Node-RED start-up log looks like this:
pizero-2@raspberrypi:~ $ node-red-start
Start Node-RED
Once Node-RED has started, point a browser at http://192.168.0.105:1880
On Pi Node-RED works better with the Firefox or Chrome browser
Use node-red-stop to stop Node-RED
Use node-red-start to start Node-RED again
Use node-red-log to view the recent log output
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot
Use sudo systemctl disable nodered.service to disable autostart on boot
To find more nodes and example flows - go to http://flows.nodered.org
Starting as a systemd service.
8 Apr 06:38:53 - [info]
Welcome to Node-RED
===================
8 Apr 06:38:53 - [info] Node-RED version: v4.0.5
8 Apr 06:38:53 - [info] Node.js version: v20.18.1
8 Apr 06:38:53 - [info] Linux 6.6.62+rpt-rpi-v8 arm64 LE
8 Apr 06:38:55 - [info] Loading palette nodes
@iiot2k/gpiox version: 3.0.4
rpi_ads1115_arm64 V2.0.5
8 Apr 06:39:08 - [info] Dashboard version 3.6.5 started at /ui
8 Apr 06:39:13 - [info] Settings file : /home/rpizero-2/.node-red/settings.js
8 Apr 06:39:13 - [info] Context store : 'default' [module=memory]
8 Apr 06:39:13 - [info] User directory : /home/rpizero-2/.node-red
8 Apr 06:39:13 - [warn] Projects disabled : editorTheme.projects.enabled=false
8 Apr 06:39:13 - [info] Flows file : /home/rpizero-2/.node-red/flows.json
8 Apr 06:39:13 - [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.
---------------------------------------------------------------------
8 Apr 06:39:14 - [info] Server now running at http://127.0.0.1:1880/
8 Apr 06:39:14 - [info] Starting flows
8 Apr 06:39:14 - [info] [ui-base:My Dashboard] Node-RED Dashboard 2.0 (v1.21.0) started at /dashboard
8 Apr 06:39:14 - [info] [ui-base:My Dashboard] Created socket.io server bound to Node-RED port at path /dashboard/socket.io
After this re-start of Node-RED all global.json.<13-digit number>.tmp files still exists in /context/global directory.
Best Regards
Richard
If ls
isn't showing the files, how do you know that they exist?
Hello Colin
I can see these files in directory /context/global using RealVNC Viewer (on my laptop) but in this files properties I can see that its volume is 0 bytes - so you are right and it looks like in that directory is only shadow of being file. But why?
I am confused. Sometimes you refer to /context/global
, sometimes to /home/rpizero-2/.node-red/context/global
These two absolute paths are not the same directory.
Do both these directories exist? What does ls -ld /context/global /home/rpizero-2/.node-red/context/global
show you?
What do you have in settings.js for context storage?
Show us what the viewer shows (screenshot) and also ls -al
of the same directory.
This path abbreviation (context/global) is related to full path home/rpi zero-2/.node-red/context/global directory.
I've attached all related informations on the Print Screen.
On the Print Screen, settings.ini file part of persistent context memory is disabled, but was enabled in the form you can see on the Print Screen.
Since ls -al
shows no files, then the only conclusion is that the file viewer is showing incorrect information. It is not a node--red problem.
If you fully shut down the pi and remove the power for 30 seconds, then start it up again, do the files disappear?
That is the point (no longer using file context), but the tmp files are still there.
So remove them and the folder they inhabit.
If filesystem context was being used and temporary files are being left over, that is a problem. In this case it seems to be cosmetic.
I believe he disabled file context in order to understand the problem. The tmp files do not exist, (he tried deleting them earlier). It is the file viewer that is confused, not realising that the tmp files have been deleted.
Thank you for yours help. The most important conclusion is the memory isn't consumed. I will restart RPi later on.
After RPi reboot Global persistent memory in directory /home/rpizero-2/.node-red/context/global is empty (clear).
So it was just the file explorer or RealVNC that were confused. The files were not actually there at all.