Company
Date Published
Author
Michael Hall
Word count
2600
Language
English
Hacker News points
None

Summary

InfluxDB is increasingly being used in IoT solutions to store data from connected devices. An instance of InfluxDB can now be used on IoT edge gateways as a data historian to analyze, visualize, and eventually transmit aggregated IoT data up to a centralized server. To connect an instance of InfluxDB on your IoT Edge device to another instance of InfluxDB in the cloud, you need a local instance of InfluxDB to use as your edge historian. You can create this by running the official Docker image and completing the setup by going to the Load Data -> API Tokens screen and grabbing the token string that was generated during setup. The token is used to set up your Influx CLI configuration. A bucket is created on this instance to store device data, with a retention policy of 1 hour in this example. To send the data from the edge instance to the cloud instance, you can create a task using Flux script that reads data from the devices bucket, performs downsampling, and sends it to the cloud instance. The downsampling is done by using the aggregateWindow function to calculate the mean value of each field over a rolling 5-minute window. This reduces the volume of data being sent to the cloud while still providing high-level use cases with the original granularity. To make the task more resilient, you can extend the retention policy on the devices bucket and create another task that reads from the downsampled data in the northbound bucket and sends it to the cloud instance every 5 minutes.