SlideShare a Scribd company logo
INTRODUCTION
TO
Hello!
I am Roberto Gaudenzi
You can find me at
robgaudenzi@gmail.com
MS in Engineering in Computer Science
Pervasive Systems
a.y. 2015-16
Prof. Chatzigiannakis
TIME-SERIES DATA
WHAT IS TIME-SERIES DATA?
A time-series is a sequence of data points,
consisting of successive measurements made
over a time interval.
Two major types: Regular and Irregular
They are used in statistics, mathematical
finance, pattern recognition, IoT, …
4
WHAT IS TIME-SERIES DATA? (2)
Examples of time-series data:
◦ Stock price evolution
◦ Bank transactions
◦ ...
Example of non time-series data:
◦ Facebook relationships
5
INFLUXDB
WHAT IS INFLUXDB?
InfluxDB is an open-source database
specifically designed to handle time-series
data.
Ideal for any use case involving large amounts
of timestamped data, including IoT sensor data
and real-time analytics.
7
Points are written to InfluxDB according to the
Line Protocol.
Three parts:
◦ The key, composed by the measurement
name and a set of tags
◦ The fields
◦ The timestamp
Example(CLI):
DATA FORMAT: THE LINE PROTOCOL
8
INSERT cpu,host=server02,region=uswest value=3
1434055562000010000
DATA FORMAT: THE LINE PROTOCOL (2)
Example(InfluxDB-Python):
client = InfluxDBClient(host, port, user, password, dbname)
json_body = [
{
"measurement": "cpu",
"tags": {
"host": "server02",
"region": "uswest"
},
"time": "2009-11-10T23:00:00Z",
"fields": {
"value": 3
}
}
]
client.write_points(json_body)
9
InfluxQL is an SQL-like query language for
interacting with data in InfluxDB.
Example (CLI):
QUERY LANGUAGE: INFLUXQL
SELECT mean(water_level) AS mean_level
FROM h2o_feet
WHERE time >= '2015-08-18'
GROUP BY time(10d)
ORDER BY time DESC
10
QUERY LANGUAGE: INFLUXQL (2)
11
Example(InfluxDB-Python):
query = “””select mean(water_level) as mean_level
from h2o_feet where time >= ’2015-08-18’
group by time(10d)
order by time DESC”””
client = InfluxDBClient(host, port, user, pwd, dbname)
# Returns an array of JSONs containing results
# from all matching series
result = client.query(query)
print("Result: {0}".format(result))
Working with much data over a long period of
time can create storage concerns.
Solutions: downsample or expire the data.
InfluxDB offers two mechanisms for dealing
with this issue: Continuous Queries and
Retention Policies.
DOWNSAMPLING AND DATA RETENTION
12
A retention policy (RP) describes:
◦ for how long InfluxDB keeps data
◦ how many copies of those data are stored
RETENTION POLICIES
13
CREATE RETENTION POLICY two_hours
ON food_data
DURATION 2h
REPLICATION 1
Example(InfluxDB-Python):
client.create_retention_policy('two_hours', '2h', 1,
'food_data',default=False)
Example (CLI):
A continuous query (CQ) is an InfluxQL query
that runs automatically and periodically within
a database.
Example (CLI):
CONTINUOUS QUERIES
14
CREATE CONTINUOUS QUERY cq_30m
ON food_data
BEGIN SELECT mean(website) AS mean_website,
mean(phone) AS mean_phone
INTO food_data."default".downsampled_orders
FROM orders
GROUP BY time(30m)
END
CONTINUOUS QUERIES (2)
15
Example(InfluxDB-Python):
query = “””
create continuous query cq_30m
on food_data
begin
select mean(website) as mean_website,
mean(phone) as mean_phone
into food_data."default".downsampled_orders
from orders
group by time(30m)
end”””
# An InfluxDBClientError will be returned in case of error
try:
result = client.query(query)
except:
print("Note: continuous query already exists.")
The built-in web admin interface is a simple
way to interact with InfluxDB.
MANAGE YOUR DATA: THE WEB INTERFACE
16
◦ Write Data
◦ Query Data
◦ Access remote
instances
INFLUXDB IN A SLIDE
“SQL-like”
HTTP APIs and
Built-in interface
Choose your
language
SQL
<>
New
Designed for time series
Flexible and scalable
17
DEMO
INFLUXDB EXAMPLE: INFLUXCHAT
◦ Simple room-chat application in Python
◦ When a user types a message, this is sent to
the server, that forwards it to all connected
users
◦ The server also stores messages into InfluxDB
◦ Continuous Query and Retention Policy for
collecting statistics about message traffic
19
INFLUXDB EXAMPLE: INFLUXCHAT (2)
20
# Set up the InfluxDB client
DB_NAME = "PervSystPers“
DB_ADDRESS = "localhost“
DB_PORT = 8086
MEASUREMENT_NAME ="influxchat“
influxdb_client = InfluxDBClient(host=DB_ADDRESS,
port=DB_PORT,
database=DB_NAME)
INFLUXDB EXAMPLE: INFLUXCHAT (3)
21
# Set up the continuous query
CONT_QUERY = “””create continuous query cq_30m on PervSystPers
begin select count(value) as num_msg
into PervSystPers."default".downsampled_msg
from influxchat
group by time(30m)
end”””
try:
result_db = influxdb_client.query(CONT_QUERY)
except:
print("Note: continuous query already exists.")
# Set up the retention policy
RET_POL_NAME = 'del_4_weeks‘
RET_POL_PERIOD = ‘4w’
RET_POL_N_COPY = 1
resultdb = influxdb_client.create_retention_policy(RET_POL_NAME,
RET_POL_PERIOD,
RET_POL_N_COPY
DB_NAME,
default=TRUE)
INFLUXDB EXAMPLE: INFLUXCHAT (4)
22
# Send the incoming message to InfluxDB
json_body = [
{
"measurement": MEASUREMENT_NAME,
"tags": {
"username": sender_name
},
"fields": {
"value": msg_content
}
}
]
influxdb_client.write_points(json_body)
Thanks!
ANY QUESTIONS?
You can find me at
robgaudenzi@gmail.com
CREDITS AND LINKS
◦ Presentation template by SlidesCarnival
◦ Code available on Github
◦ Presentation available on Slideshare
◦ You can find me also on LinkedIn
24

More Related Content

What's hot

Influxdb and time series data
Influxdb and time series dataInfluxdb and time series data
Influxdb and time series data
Marcin Szepczyński
 
Introduction to InfluxDB and TICK Stack
Introduction to InfluxDB and TICK StackIntroduction to InfluxDB and TICK Stack
Introduction to InfluxDB and TICK Stack
Ahmed AbouZaid
 
Grafana.pptx
Grafana.pptxGrafana.pptx
Grafana.pptx
Bhushan Rane
 
Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
Julien Pivotto
 
Cloud Monitoring tool Grafana
Cloud Monitoring  tool Grafana Cloud Monitoring  tool Grafana
Cloud Monitoring tool Grafana
Dhrubaji Mandal ♛
 
Intro to Telegraf
Intro to TelegrafIntro to Telegraf
Intro to Telegraf
InfluxData
 
Intro to Time Series
Intro to Time Series Intro to Time Series
Intro to Time Series
InfluxData
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With Prometheus
Knoldus Inc.
 
Fall in Love with Graphs and Metrics using Grafana
Fall in Love with Graphs and Metrics using GrafanaFall in Love with Graphs and Metrics using Grafana
Fall in Love with Graphs and Metrics using Grafana
torkelo
 
Real-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerReal-time analytics with Druid at Appsflyer
Real-time analytics with Druid at Appsflyer
Michael Spector
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
Altinity Ltd
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
Shiao-An Yuan
 
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdfPrometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Knoldus Inc.
 
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
Best Practices: How to Analyze IoT Sensor Data with InfluxDBBest Practices: How to Analyze IoT Sensor Data with InfluxDB
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
InfluxData
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka Streams
Guido Schmutz
 
Understanding InfluxDB Basics: Tags, Fields and Measurements
Understanding InfluxDB Basics: Tags, Fields and MeasurementsUnderstanding InfluxDB Basics: Tags, Fields and Measurements
Understanding InfluxDB Basics: Tags, Fields and Measurements
InfluxData
 
Grafana 7.0
Grafana 7.0Grafana 7.0
Grafana 7.0
Juraj Hantak
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflix
nkorla1share
 
What's New in Apache Hive
What's New in Apache HiveWhat's New in Apache Hive
What's New in Apache Hive
DataWorks Summit
 
Need for Time series Database
Need for Time series DatabaseNeed for Time series Database
Need for Time series Database
Pramit Choudhary
 

What's hot (20)

Influxdb and time series data
Influxdb and time series dataInfluxdb and time series data
Influxdb and time series data
 
Introduction to InfluxDB and TICK Stack
Introduction to InfluxDB and TICK StackIntroduction to InfluxDB and TICK Stack
Introduction to InfluxDB and TICK Stack
 
Grafana.pptx
Grafana.pptxGrafana.pptx
Grafana.pptx
 
Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
 
Cloud Monitoring tool Grafana
Cloud Monitoring  tool Grafana Cloud Monitoring  tool Grafana
Cloud Monitoring tool Grafana
 
Intro to Telegraf
Intro to TelegrafIntro to Telegraf
Intro to Telegraf
 
Intro to Time Series
Intro to Time Series Intro to Time Series
Intro to Time Series
 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With Prometheus
 
Fall in Love with Graphs and Metrics using Grafana
Fall in Love with Graphs and Metrics using GrafanaFall in Love with Graphs and Metrics using Grafana
Fall in Love with Graphs and Metrics using Grafana
 
Real-time analytics with Druid at Appsflyer
Real-time analytics with Druid at AppsflyerReal-time analytics with Druid at Appsflyer
Real-time analytics with Druid at Appsflyer
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdfPrometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
Prometheus-Grafana-RahulSoni1584KnolX.pptx.pdf
 
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
Best Practices: How to Analyze IoT Sensor Data with InfluxDBBest Practices: How to Analyze IoT Sensor Data with InfluxDB
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
 
Spark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka StreamsSpark (Structured) Streaming vs. Kafka Streams
Spark (Structured) Streaming vs. Kafka Streams
 
Understanding InfluxDB Basics: Tags, Fields and Measurements
Understanding InfluxDB Basics: Tags, Fields and MeasurementsUnderstanding InfluxDB Basics: Tags, Fields and Measurements
Understanding InfluxDB Basics: Tags, Fields and Measurements
 
Grafana 7.0
Grafana 7.0Grafana 7.0
Grafana 7.0
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflix
 
What's New in Apache Hive
What's New in Apache HiveWhat's New in Apache Hive
What's New in Apache Hive
 
Need for Time series Database
Need for Time series DatabaseNeed for Time series Database
Need for Time series Database
 

Viewers also liked

InfluxDB: Upgrade to 0.10 considerations
InfluxDB: Upgrade to 0.10 considerationsInfluxDB: Upgrade to 0.10 considerations
InfluxDB: Upgrade to 0.10 considerations
Sean Beckett
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
Fabrizio Farinacci
 
Weathercraft Presentation
Weathercraft PresentationWeathercraft Presentation
Weathercraft Presentation
Lorenzo Travagliati
 
Presentation raspberry pi
Presentation   raspberry piPresentation   raspberry pi
Presentation raspberry pi
Marco Casini
 
Intel Curie Presentation
Intel Curie PresentationIntel Curie Presentation
Intel Curie Presentation
Davide Tiriticco
 
Neo4j and graph databases introduction
Neo4j and graph databases introduction Neo4j and graph databases introduction
Neo4j and graph databases introduction
Stefano Conoci
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
AltBeaconAltBeacon
AltBeacon
Sara Veterini
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
Biagio Botticelli
 
Convertigo Mobility Platform | Mobile Application Development for Enterprises...
Convertigo Mobility Platform | Mobile Application Development for Enterprises...Convertigo Mobility Platform | Mobile Application Development for Enterprises...
Convertigo Mobility Platform | Mobile Application Development for Enterprises...
Convertigo | MADP & MBaaS
 
Smart Museum
Smart MuseumSmart Museum
Smart Museum
Guamaral Vasil
 
Grafana zabbix
Grafana zabbixGrafana zabbix
Grafana zabbix
alexanderzobnin
 
Alerting in Grafana, Grafanacon 2015
Alerting in Grafana, Grafanacon 2015Alerting in Grafana, Grafanacon 2015
Alerting in Grafana, Grafanacon 2015
Dieter Plaetinck
 
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Hakka Labs
 
Grafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and ChallengesGrafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and Challenges
Philip Wernersbach
 
Monitoring the #DevOps way
Monitoring the #DevOps wayMonitoring the #DevOps way
Monitoring the #DevOps way
Theo Schlossnagle
 
Stop using Nagios (so it can die peacefully)
Stop using Nagios (so it can die peacefully)Stop using Nagios (so it can die peacefully)
Stop using Nagios (so it can die peacefully)
Andy Sykes
 
Smart garden
Smart gardenSmart garden
Smart garden
Stefano Coratti
 

Viewers also liked (18)

InfluxDB: Upgrade to 0.10 considerations
InfluxDB: Upgrade to 0.10 considerationsInfluxDB: Upgrade to 0.10 considerations
InfluxDB: Upgrade to 0.10 considerations
 
RecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeoverRecipeX - Your personal caregiver and lifestyle makeover
RecipeX - Your personal caregiver and lifestyle makeover
 
Weathercraft Presentation
Weathercraft PresentationWeathercraft Presentation
Weathercraft Presentation
 
Presentation raspberry pi
Presentation   raspberry piPresentation   raspberry pi
Presentation raspberry pi
 
Intel Curie Presentation
Intel Curie PresentationIntel Curie Presentation
Intel Curie Presentation
 
Neo4j and graph databases introduction
Neo4j and graph databases introduction Neo4j and graph databases introduction
Neo4j and graph databases introduction
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
 
AltBeacon
AltBeaconAltBeacon
AltBeacon
 
Adafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi BoardAdafruit Huzzah Esp8266 WiFi Board
Adafruit Huzzah Esp8266 WiFi Board
 
Convertigo Mobility Platform | Mobile Application Development for Enterprises...
Convertigo Mobility Platform | Mobile Application Development for Enterprises...Convertigo Mobility Platform | Mobile Application Development for Enterprises...
Convertigo Mobility Platform | Mobile Application Development for Enterprises...
 
Smart Museum
Smart MuseumSmart Museum
Smart Museum
 
Grafana zabbix
Grafana zabbixGrafana zabbix
Grafana zabbix
 
Alerting in Grafana, Grafanacon 2015
Alerting in Grafana, Grafanacon 2015Alerting in Grafana, Grafanacon 2015
Alerting in Grafana, Grafanacon 2015
 
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
Introduction to InfluxDB, an Open Source Distributed Time Series Database by ...
 
Grafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and ChallengesGrafana and MySQL - Benefits and Challenges
Grafana and MySQL - Benefits and Challenges
 
Monitoring the #DevOps way
Monitoring the #DevOps wayMonitoring the #DevOps way
Monitoring the #DevOps way
 
Stop using Nagios (so it can die peacefully)
Stop using Nagios (so it can die peacefully)Stop using Nagios (so it can die peacefully)
Stop using Nagios (so it can die peacefully)
 
Smart garden
Smart gardenSmart garden
Smart garden
 

Similar to Introduction to influx db

Introduction to InfluxDB
Introduction to InfluxDBIntroduction to InfluxDB
Introduction to InfluxDB
Jorn Jambers
 
Introduction to Large Scale Data Analysis with WSO2 Analytics Platform
Introduction to Large Scale Data Analysis with WSO2 Analytics PlatformIntroduction to Large Scale Data Analysis with WSO2 Analytics Platform
Introduction to Large Scale Data Analysis with WSO2 Analytics Platform
Srinath Perera
 
Cloud-based Stream Analytics VS InfuxDB Time-series analytics
Cloud-based Stream Analytics  VS InfuxDB Time-series analyticsCloud-based Stream Analytics  VS InfuxDB Time-series analytics
Cloud-based Stream Analytics VS InfuxDB Time-series analytics
LeonardoSalvucci1
 
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
WSO2
 
Influx data basic
Influx data basicInflux data basic
Influx data basic
Сергій Саварин
 
Linux capacity planning
Linux capacity planningLinux capacity planning
Linux capacity planning
Francisco Gonçalves
 
Stream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDBStream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDB
confluent
 
Spark Streaming and IoT by Mike Freedman
Spark Streaming and IoT by Mike FreedmanSpark Streaming and IoT by Mike Freedman
Spark Streaming and IoT by Mike Freedman
Spark Summit
 
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
InfluxData
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learn
confluent
 
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Brian Brazil
 
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
HostedbyConfluent
 
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB
 
Streaming in the Wild with Apache Flink
Streaming in the Wild with Apache FlinkStreaming in the Wild with Apache Flink
Streaming in the Wild with Apache Flink
DataWorks Summit/Hadoop Summit
 
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Jim Czuprynski
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
Damien Dallimore
 
Social media analytics using Azure Technologies
Social media analytics using Azure TechnologiesSocial media analytics using Azure Technologies
Social media analytics using Azure Technologies
Koray Kocabas
 
Serverless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis AnalyticsServerless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis Analytics
Amazon Web Services
 
Applying linear regression and predictive analytics
Applying linear regression and predictive analyticsApplying linear regression and predictive analytics
Applying linear regression and predictive analytics
MariaDB plc
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
Mark Kromer
 

Similar to Introduction to influx db (20)

Introduction to InfluxDB
Introduction to InfluxDBIntroduction to InfluxDB
Introduction to InfluxDB
 
Introduction to Large Scale Data Analysis with WSO2 Analytics Platform
Introduction to Large Scale Data Analysis with WSO2 Analytics PlatformIntroduction to Large Scale Data Analysis with WSO2 Analytics Platform
Introduction to Large Scale Data Analysis with WSO2 Analytics Platform
 
Cloud-based Stream Analytics VS InfuxDB Time-series analytics
Cloud-based Stream Analytics  VS InfuxDB Time-series analyticsCloud-based Stream Analytics  VS InfuxDB Time-series analytics
Cloud-based Stream Analytics VS InfuxDB Time-series analytics
 
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
[WSO2Con EU 2017] Deriving Insights for Your Digital Business with Analytics
 
Influx data basic
Influx data basicInflux data basic
Influx data basic
 
Linux capacity planning
Linux capacity planningLinux capacity planning
Linux capacity planning
 
Stream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDBStream me to the Cloud (and back) with Confluent & MongoDB
Stream me to the Cloud (and back) with Confluent & MongoDB
 
Spark Streaming and IoT by Mike Freedman
Spark Streaming and IoT by Mike FreedmanSpark Streaming and IoT by Mike Freedman
Spark Streaming and IoT by Mike Freedman
 
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learn
 
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
Your data is in Prometheus, now what? (CurrencyFair Engineering Meetup, 2016)
 
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
Considerations for Abstracting Complexities of a Real-Time ML Platform, Zhenz...
 
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
 
Streaming in the Wild with Apache Flink
Streaming in the Wild with Apache FlinkStreaming in the Wild with Apache Flink
Streaming in the Wild with Apache Flink
 
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
Keep Your Code Low, Low, Low, Low, Low: Getting to Digitally Driven With Orac...
 
Splunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the messageSplunk Conf 2014 - Getting the message
Splunk Conf 2014 - Getting the message
 
Social media analytics using Azure Technologies
Social media analytics using Azure TechnologiesSocial media analytics using Azure Technologies
Social media analytics using Azure Technologies
 
Serverless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis AnalyticsServerless Streaming Data Processing using Amazon Kinesis Analytics
Serverless Streaming Data Processing using Amazon Kinesis Analytics
 
Applying linear regression and predictive analytics
Applying linear regression and predictive analyticsApplying linear regression and predictive analytics
Applying linear regression and predictive analytics
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
 

Recently uploaded

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 

Recently uploaded (20)

Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 

Introduction to influx db

  • 2. Hello! I am Roberto Gaudenzi You can find me at robgaudenzi@gmail.com MS in Engineering in Computer Science Pervasive Systems a.y. 2015-16 Prof. Chatzigiannakis
  • 4. WHAT IS TIME-SERIES DATA? A time-series is a sequence of data points, consisting of successive measurements made over a time interval. Two major types: Regular and Irregular They are used in statistics, mathematical finance, pattern recognition, IoT, … 4
  • 5. WHAT IS TIME-SERIES DATA? (2) Examples of time-series data: ◦ Stock price evolution ◦ Bank transactions ◦ ... Example of non time-series data: ◦ Facebook relationships 5
  • 7. WHAT IS INFLUXDB? InfluxDB is an open-source database specifically designed to handle time-series data. Ideal for any use case involving large amounts of timestamped data, including IoT sensor data and real-time analytics. 7
  • 8. Points are written to InfluxDB according to the Line Protocol. Three parts: ◦ The key, composed by the measurement name and a set of tags ◦ The fields ◦ The timestamp Example(CLI): DATA FORMAT: THE LINE PROTOCOL 8 INSERT cpu,host=server02,region=uswest value=3 1434055562000010000
  • 9. DATA FORMAT: THE LINE PROTOCOL (2) Example(InfluxDB-Python): client = InfluxDBClient(host, port, user, password, dbname) json_body = [ { "measurement": "cpu", "tags": { "host": "server02", "region": "uswest" }, "time": "2009-11-10T23:00:00Z", "fields": { "value": 3 } } ] client.write_points(json_body) 9
  • 10. InfluxQL is an SQL-like query language for interacting with data in InfluxDB. Example (CLI): QUERY LANGUAGE: INFLUXQL SELECT mean(water_level) AS mean_level FROM h2o_feet WHERE time >= '2015-08-18' GROUP BY time(10d) ORDER BY time DESC 10
  • 11. QUERY LANGUAGE: INFLUXQL (2) 11 Example(InfluxDB-Python): query = “””select mean(water_level) as mean_level from h2o_feet where time >= ’2015-08-18’ group by time(10d) order by time DESC””” client = InfluxDBClient(host, port, user, pwd, dbname) # Returns an array of JSONs containing results # from all matching series result = client.query(query) print("Result: {0}".format(result))
  • 12. Working with much data over a long period of time can create storage concerns. Solutions: downsample or expire the data. InfluxDB offers two mechanisms for dealing with this issue: Continuous Queries and Retention Policies. DOWNSAMPLING AND DATA RETENTION 12
  • 13. A retention policy (RP) describes: ◦ for how long InfluxDB keeps data ◦ how many copies of those data are stored RETENTION POLICIES 13 CREATE RETENTION POLICY two_hours ON food_data DURATION 2h REPLICATION 1 Example(InfluxDB-Python): client.create_retention_policy('two_hours', '2h', 1, 'food_data',default=False) Example (CLI):
  • 14. A continuous query (CQ) is an InfluxQL query that runs automatically and periodically within a database. Example (CLI): CONTINUOUS QUERIES 14 CREATE CONTINUOUS QUERY cq_30m ON food_data BEGIN SELECT mean(website) AS mean_website, mean(phone) AS mean_phone INTO food_data."default".downsampled_orders FROM orders GROUP BY time(30m) END
  • 15. CONTINUOUS QUERIES (2) 15 Example(InfluxDB-Python): query = “”” create continuous query cq_30m on food_data begin select mean(website) as mean_website, mean(phone) as mean_phone into food_data."default".downsampled_orders from orders group by time(30m) end””” # An InfluxDBClientError will be returned in case of error try: result = client.query(query) except: print("Note: continuous query already exists.")
  • 16. The built-in web admin interface is a simple way to interact with InfluxDB. MANAGE YOUR DATA: THE WEB INTERFACE 16 ◦ Write Data ◦ Query Data ◦ Access remote instances
  • 17. INFLUXDB IN A SLIDE “SQL-like” HTTP APIs and Built-in interface Choose your language SQL <> New Designed for time series Flexible and scalable 17
  • 18. DEMO
  • 19. INFLUXDB EXAMPLE: INFLUXCHAT ◦ Simple room-chat application in Python ◦ When a user types a message, this is sent to the server, that forwards it to all connected users ◦ The server also stores messages into InfluxDB ◦ Continuous Query and Retention Policy for collecting statistics about message traffic 19
  • 20. INFLUXDB EXAMPLE: INFLUXCHAT (2) 20 # Set up the InfluxDB client DB_NAME = "PervSystPers“ DB_ADDRESS = "localhost“ DB_PORT = 8086 MEASUREMENT_NAME ="influxchat“ influxdb_client = InfluxDBClient(host=DB_ADDRESS, port=DB_PORT, database=DB_NAME)
  • 21. INFLUXDB EXAMPLE: INFLUXCHAT (3) 21 # Set up the continuous query CONT_QUERY = “””create continuous query cq_30m on PervSystPers begin select count(value) as num_msg into PervSystPers."default".downsampled_msg from influxchat group by time(30m) end””” try: result_db = influxdb_client.query(CONT_QUERY) except: print("Note: continuous query already exists.") # Set up the retention policy RET_POL_NAME = 'del_4_weeks‘ RET_POL_PERIOD = ‘4w’ RET_POL_N_COPY = 1 resultdb = influxdb_client.create_retention_policy(RET_POL_NAME, RET_POL_PERIOD, RET_POL_N_COPY DB_NAME, default=TRUE)
  • 22. INFLUXDB EXAMPLE: INFLUXCHAT (4) 22 # Send the incoming message to InfluxDB json_body = [ { "measurement": MEASUREMENT_NAME, "tags": { "username": sender_name }, "fields": { "value": msg_content } } ] influxdb_client.write_points(json_body)
  • 23. Thanks! ANY QUESTIONS? You can find me at robgaudenzi@gmail.com
  • 24. CREDITS AND LINKS ◦ Presentation template by SlidesCarnival ◦ Code available on Github ◦ Presentation available on Slideshare ◦ You can find me also on LinkedIn 24