Storage value on Nas

I use Node red to communicate my raspberry pi with a esp8266. On this board I connected a temperature sensor and a led.
Now I would like to storing my value on my Nas which is my network.
How can I do?
Best regards

Most people would look to use a database. I think that most NAS's will have database apps that you can run. I know that my Synology will run various databases such as MySQL (or the related MariaDB).

A couple of my IoT students are doing a similar thing...

They have a Wemos D1 Mini (ESP8266-based microcontroller flashed with ESP-Easy) board with a BME280 sensor (to read temp, humidity and pressure). These values are sent via MQTT to a Raspberry Pi where a Node-RED flow processes the data and writes it to a MySQL database. The database they are using is at a remote location (so they can access the data from home) but it could have been local (i.e. on a NAS on the local area network).

Hope this helps.

I have a QNAP NAS at home and that can certainly deal with MySQL dB.

Also worth noting that InfluxDB is ideal for recording time-based data. However, it isn't available pre-packaged on the Synology NAS, don't know about QNAP. It is generally easiest if you buy or build an Intel/AMD based NAS rather than an ARM one since you generally get a better range of available software.

Many NAS's will let you install other software since they are basically Linux based computers at heart. However, because they have kernels and OS's optimised for ease of use, it can often be difficult to deal with non-standard installs.

Hi Julian,
instead of having an InfluxDB running on the NAS, can you also have an InfluxDB running on a Raspberry but which stores its data on the NAS? E.g. via a mount or a path to the NAS or ... ?

You probably can technically but I'm not sure I would recommend it due to the latency between a Pi with potentially only a 10Mbps connection and limited memory and the NAS.

It would be much more efficient to send the data direct to the NAS unless you have really high data rates.

Though some kind of hybrid might be achievable. Such as short-term higher frequency data (once a minute for 24 hrs lets say) on the Pi with long term lower frequency data on the NAS (potentially unlimited hourly data).

Actually though, I have very little in the way of issues with InfluxDB even on a Pi2. I keep 7d of 1 minute data (not sure how many data points, maybe 40-50) with InfluxDB automatically summarising the data to hourly (with max, min and avg) which I keep pretty well indefinitely (several years anyway).

Direct connections to databases will generally be the most efficient since the connections are optimised for remote use.

1 Like

seems you are right, based on the influxdb documentation:

InfluxDB is designed to run on SSDs. InfluxData does not test on HDDs or networked storage devices, and we do not recommend them for production. Performance is an order of magnitude lower on spinning disk drives and the system may break down under even moderate load. For best results InfluxDB servers must have at least 1000 IOPS on the storage system...

In this issue they also say that it is not advised to mount a network drive ...

So it seems like you indeed have to install InfluxDB on the nas, like in this tutorial.

OK thank you for your helps.
I am going to see I can use MySQL database.
I thank that was possible to store datas with a node on my raspberry and about once a week (for example) send datas on my Nas. My Personal Nas is a Lenovo Nas.
Best regards

Hey @ced,
I did a test last year by installing InfluxDb on my raspberry, simply to store the measurements of the magnetic contacts on my doors. After a few weeks my entire system was lost, due to a failure of my SSD card. So be careful if you want to write continiously data on an SSD card!

OK I understand
So in fact it is not the good choice.

Hey @ced,
Perhaps not exactly what you are looking for, but I see in this issue that @janvda has been playing with InfluxDb data on an external USB SSD drive. That is not really a network share, but perhaps Jan can share his experiences here ...

It all depends on the amount of data. I have a Pi which has been running node red, influx and grafana on an SD card for about three years without problems. It is storing a handful of values every 30 seconds. However when you look at the amount of data being written it is far less than is logged to syslog, so the extra writes from influx are not significant. As always with a Pi the quality of SD card and the quality of the PSU are critical.
It doesn't make any difference whether you are saving data to SD card or HDD, if the historical data is important then you must make sure you back it up.
Also, with regard to the documents saying that influx should be used with an SSD then you must bear in mind that it all depends on the amount of data that is being stored and queried. The influx docs generally assume that one is building much larger and/or faster systems than are required for home automation and similar enterprises, and in particular a commercial system may have many clients connected whereas more basic systems may have one or two max. I have another Pi where the influx data is on a USB2 external drive and around 50 values are logged, some every 5 seconds. Again the performance is perfectly adequate.

[Edit] Scroll up a bit in the doc that talks about needing an SSD and it says that a low load system is one that has less than 5000 writes/second.

1 Like

Glad to share some experience :slight_smile:

@BartButenaers, so you are referring to

Note that I wasn't using an external SSD drive but a 32 GB memory stick connected to the raspberry pi USB port.

I admit that I am no longer using this solution myself. In my case I was also running kodi on the same raspberry pi and this together with the other 8 services (container applications) was a bit too much for a raspberry pi.

I would guess that the main issue was the physical memory limitation of the raspberry pi. Especially when restarting the raspberry pi I saw that memory of the influx DB went up to 270 MB (while normally it is between 50 and 150 MB).

So bottomline, I still think that you can use influx db on a raspberry pi (where the influx db data is stored in memory stick connected to the USB port) in combination with several other services (node-red) but there is of course a limit (most likely the physical memory of your raspberry pi).

Also depending on the data you are writing/reading to the influx db, the memory stick solution might not be performant enough.

1 Like

It is if you set your Pi up correctly.

I've been running 2 Pi's continuously for several years now with the same SD cards and have no issues at all.

You need a decent SD card first, I always use Samsung EVO or EVO Pro. Make sure you get one a lot bigger than you think. I always use 32GB which are still pretty cheap. The reason for this is not about running out of space but about allowing the card's built-in wear levelling routines to work well.

Try not to cut power to the Pi very often (do proper shutdowns when you can) and make sure you are using a decent power supply. I also put mine on a PC UPS along with other critical kit.