Best way to store data during Internet outages (then send)

Hello. I am using NR on various devices to record temperature data every 1 minute. Readings are sent to InfluxDB (which hosted on Debian on Amazon EC2) using the Influx out node. System works perfectly. But....

When we lose Internet access, NR cannot see the InfluxDB on AWS, and therefore there can be minutes or hours where there is no data in Influx.

Is there a good way to handle this scenario? Since the amount of data being loaded every minute is rather small in size, it might make sense to set up another InfluxDB on a local device (that can still be reached during Internet outages). But then one would have to manually find the missing readings and move them from the local InfluxDB to the one on AWS. Any suggestions are appreciated.

You can use a catch node with your Influx node as only target. When errors occur, the catch node will trigger and you can log these message payloads (which should be your influx points) into a file, which can be imported later. Be sure to send a timestamp along with your points.

I'm using this approach for nearly all my setups, works with the MySQL and MSSQL nodes, too.

Have a look at this flow which provides guaranteed delivery of messages. The example shows how to use it for email but the most recent influxdb nodes support Complete and Catch so it is trivial to change it for use with influx. Just replace the email node in the example with the influx node.
It automatically queues messages when sending attempts fail and then releases them when possible.
If a persistent context store is enabled it will even save them over a node-red restart or power fail.

https://flows.nodered.org/flow/05e6d61f14ef6af763ec4cfd1049ab61

Thank you both Kuema and Colin. I will try both of these and report back.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.