204
F. Firouzi and B. Farahani
will obtain the correct updated value. In addition, Redis is a multi-utility tool that
can be used for caching, messaging queues (supports Publish/Subscribe), and shortlife data such as application sessions, page hits, etc.
4.6.1.4 InfluxDB
InfluxDB is a big data, open-source NoSQL time-series database that supports high
availability, massive scalability, and quick read and write functions. This NoSQL
database is designed to store time-series data (series of regular or irregular data
points across time) very efficiently, which makes it a great solution to store IoT
sensor readouts. Regular data measurements take the form of fixed time intervals
(i.e., heartbeat monitoring system data), while irregular data measurements are
based on events such as sensor data, trading transaction data, etc. InfluxDB also
provides query language similar to SQL that is easily tailored to search aggregated
data [21].
In order to fully understand InfluxDB, it is important to define a few key
concepts. The illustration in Table 4.4 demonstrates these vital concepts using a reallife example of car-counting sensors. This table shows the number of cars counted
by two connected parking sensors mounted at Location 1 and Location 2 during a
specific time interval.
• Time – Each InfluxDB database includes a time column that stores timestamps
associated with corresponding data.
• Field – The next column (#Cars) in our example is field. Fields referred to as
attributes as well. Fields are key-value pairs within the data structure responsible
for recording real data values as well as metadata. Fields are comprised of field
values and field keys. Field keys are strings and store metadata. The field value
can be in the form of floats, strings, Booleans, or integers. As a time-series
database, InfluxDB requires that each field value be associated with a particular
timestamp. In our example, “#Cars” is the key and 10, 5, 5, 7, 9, and 2 are field
values (see Table 4.4).
• Tags – The final two database columns in the sample (location and owner) are
known as tags, which are comprised of tag values and tag keys. Tag values and
keys are maintained as strings and represent metadata. In our example, “Owner’
is tag key and “Farshad/Bahar” is tag value.
Table 4.4 An example of
InfluxDB data model
Time
#Cars Location Owner
2019-05-31T00:00:00Z 10
1
Farshad
2015-05-31T00:06:00Z
5
2
Bahar
2015-05-31T05:54:00Z
5
1
Farshad
2015-05-31T06:00:00Z
7
2
Bahar
2015-05-31T06:06:00Z
9
1
Farshad
2015-05-31T06:12:00Z
2
2
Bahar
Précédent

- 211/647

Suivant