InfluxDB
Introduction to InfluxDB
KIT – Die Forschungsuniversität in der Helmholtz-Gemeinschaft www.kit.edu
Components of monitoring architecture
Data collection Data storage Data visualization
Queries the datasource
push data and it returns data
Logstash Beats
2 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Agenda
What is InfluxDB?
Time Series Data and Databases
Data model of InfluxDB
Query languge flux
3 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
What is InfluxDB
InfluxDB, released in 2013, is a time series database
evolved into a time series application development platform
InfluxDB includes the InfluxDB User Interface (InfluxDB UI) and Flux
used for server monitoring, financial applications, customer facing IoT and many other
applications.
InfluxData Inc. → https://www.influxdata.com
written in Go programming language, also called Golang
supports many programming languages like Java, JavaScript, Perl, PHP, Python...
4 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
InfluxDB versions
InfluxData offers three different versions
InfluxDB: Open Source
InfluxCloud: fully customised and has a web-based user interface for the
data ingestion and visualization
InfluxEnterprise: installed on the server within a corporate network. It
provides maintenance agreements and special access controls for the
business customers
5 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
What are Time Series?
Time series data is a sequence of data points indexed in time order.
Data points typically consist of successive measurements made from the
same source and are used to track changes over time.
Examples: weather data, monitoring data, Stock prices...
everything that can be viewed over time!
6 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
What are Time-Series Databases
A time series database is defined as a database system optimised to
provide the time series data and its storage in association with the value
and time
Times series databases can ingest millions of data points per second,
resulting in high-level performance
7 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Why use InfluxDB
storing large amounts of data
faster than traditional databases for time series data
Real-time data and parallel incoming data possible
Includes UI dashboards to see the data such as Chronograf, Grafana
It is easy to build, easy to share templates via influxdb templates
InfluxDB is a storage, ingest, query, and visualisation platform that you
can access through a unified API
8 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Write data to Influx
InfluxDB provides many different options for ingesting or writing data,
including the following
Influx user interface
InfluxDB HTTP API
Influx Cli
Telegraf
InfluxDB client libraries
9 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Data model
Bucket: Named location where time series data is stored
A bucket can contain multiple measurements.
Measurements: Logical grouping for time series data.
A measurement contains multiple tags and fields.
– Tag values → describe/identify the data points
– Field values → the actual measured values
– Timestamp → the time of the measurement
10 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Data model example
name of the
Fields value(s) timestamp
measurement Tag values(s)
Temperatur,place=room1,sensor=1 temp=24.5 159345356
Temperatur,place=room2,sensor=1 temp=20,5 159345350
Temperatur,place=room2 temp=20,5 159345350
11 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Query Language
InfluxQL
for the first version of InfluxDB
SQL-like query language
Flux
Since version 1.8
a functional data scripting language designed for querying, processing,
writing, analyzing, and acting on data
based on JavaScript
published by InfluxData on GitHub as an open-source project
12 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Flux Query
A Flux query does the following:
- Retrieves a specified amount of data from a source.
- Filters data based on time or column values.
- Processes and shapes data into expected results.
- Returns the result.
from(bucket: "example-bucket")
|> range(start: -1d)
|> filter(fn: (r) => r._measurement == "example-measurement")
|> mean()
|> yield(name: "_results")
13 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Flux Query
When querying InfluxDB with Flux, there are three primary functions:
from(): Queries data from an InfluxDB bucket.
range(): Filters data based on time bounds. Flux requires
“bounded” queries - queries limited to a specific time range.
filter(): Filters data based on column values.
multiple filters possible
More functions: https://docs.influxdata.com/flux/v0.x/stdlib
14 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Examples of time ranges
Query a time range relative to now
from(bucket: "example-bucket")
|> range(start: -12h)
Query an absolute time range
from(bucket: "example-bucket")
|> range(start: 2021-05-22T23:30:00Z, stop: 2021-05-23T00:00:00Z)
Query an absolute time range using Unix timestamps
from(bucket: "example-bucket")
|> range(start: 1621726200, stop: 1621728000)
15 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC
Links
https://www.influxdata.com/products/influxdb-overview/
Dokumentation:
https://docs.influxdata.com/influxdb/v2.6/
Free courses:
https://university.influxdata.com/catalog/
InfluxData community
https://community.influxdata.com
16 23.01.2023 Melanie Ernst – Introduction InfluxDB SCC