InfluxDB. Time series database
The information provided below is intended to be complementary to the project script and is not required reading.
Motivation
Data management and storage has become a vitally important aspect in any IIoT&CPS architecture. In the case of your project, the use of a temporary type database is required, which means that it is capable of storing, in addition to the data, at what moment of time each specific data has been written in the database, that can interface with Node-RED, Grafana and Matlab. The selected product is InfluxDB in its version 1.8.
Throughout the entire document we provide you with links to specific directories of the official documentation of InfluxDB in its version 1.8, which is the following:
https://docs.influxdata.com/influxdb/v1.8/
Data structure
Different series of data or measurements can be stored in the same InfluxDB database. Taking an example of an Excel file (referred to as a workbook) that represents an InfluxDB database, each sheet in the Excel file would be a data string. Therefore, if you want to store data about an industrial process, you can define a series of data for each physical magnitude you want to record: temperature, pressure, level, etc. Therefore, the data can be organized in different databases (databases) and within the same database, in different data series (measurements).
When an InfluxDB database receives a new measurement, it associates said data with a measurement hour (a moment in time), which is called a timestamp. By default, the time assigned to the data is the time at which it entered the database, but it is also possible to manually define the timestamp we want to store.
The following screenshot is provided to emphasize that when we speak of a new measure or new data we refer to a new entry, which may contain numerical values, words, etc. In it you can also observe the timestamps (time column) associated with each data entry.

Fields and tags
The data that is stored in a particular InfluxDB data string is always made up of one or more fields, and optionally one or more tags.
The fields are the information that you want to store. In the screenshot example above, the fields are the number of butterflies (butterflies) and bees (honeybees) that two scientists have observed.
On the other hand, the tags, which in the previous capture are the location (location) and the responsible scientist (scientist), provide additional information that allows optimizing the filtering of information in the case of wanting to identify only specific data entries.
You can find specific technical information at the following link:
https://docs.influxdata.com/influxdb/v1.8/concepts/key_concepts/
Data format and syntax
You must be aware of the data types that each element supports (measurement, timestamp, field, tag) as well as their syntax.
You can find information at the following link:
https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/
InfluxDB interaction
InfluxDB offers a command line interface (CLI) that allows you to browse the data stored in your data series. To do this, it is necessary to communicate with the database in InfluxDB's own query language: InfluxQL or Influx Query Language.
You have a small demonstration in video format with the procedures related to the development of the project.
You can find more specific technical information that mentions all the commands and functionalities in the following link:
https://docs.influxdata.com/influxdb/v1.8/query_language/
Communication via HTTP
The InfluxDB API (or Application Programming Interface) allows you to communicate with InfluxDB databases using HTTP requests (by default on port 8086). Databases have the ability to issue responses in JSON format.
As an example, in the project guide document you are provided with an HTTP query in the form of a URL (at the point that refers to the configuration of the ports of the virtual machine).
You can find technical information on the HTTP requests they support and their format at the following link:
https://docs.influxdata.com/influxdb/v1.8/tools/api/#query-http-endpoint
InfluxDB compatibility
As mentioned above, compatibility between applications is essential to guarantee the proper functioning of the technological solution that is intended to be designed. This section provides the relationship of InfluxDB with the other software used in the development of the project.
With Node-RED
Within the Node-RED palette you can find several libraries that allow you to work with InfluxDB databases. The library used in the project that you will develop is the following:
https://flows.nodered.org/node/node-red-contrib-influxdb
With Grafana
In the official InfluxDB documentation you can find the procedure to configure an InfluxDB database in Grafana:
https://docs.influxdata.com/influxdb/v1.8/tools/grafana/
On the other hand, the official Grafana documentation provides specific information about the plugin that Grafana uses to be compatible with InfluxDB databases:
https://grafana.com/docs/grafana/latest/datasources/influxdb/
With MATLAB
The following library will be used to work with InfluxDB from MATLAB: