SlideShare a Scribd company logo
Session 5 - Data Persistency (Draco, Cygnus, STH Comet,
Quantum Leap)
Fernando López, Cloud & Platform Senior Expert
fernando.lopez@fiware.org
@flopezaguilar
FIWARE Foundation, e.V.
Learning Goals
1
● What is Data Persistrency?
● What is a Time Series Database?
● What is the different between Cygnus and Draco compares with Quantum Leap
and STH-Comet?
● Which main technology is behind is solution?
2
Draco: Persisting Context Data to MongoDB
Draco GE
▪ Ingestion and persistency of data
▪ Easy to use, powerful, and reliable system for processing and distributing data
▪ Based on Apache NiFi, dataflow system based on the concepts of flow-based
programming
▪ Support powerful and scalable directed graphs of data routing, transformation, and
system mediation logic
▪ Built to automate the flow of data between systems
3
Features
● NGSIv2 Support both for ingestion and serialization to have full integration with the Orion Context Broker.
● Several persistent backends :
● MySQL, the well-know relaEonal database manager.
● MongoDB, the NoSQL document-oriented database.
● PostgreSQL, the well-know relaEonal database manager.
● HDFS, Hadoop distributed file system.
● Cassandra, Distributed database.
● CartoDB, for geospaEal Data
● Templates for some common scenarios
● Rest API
4
Apache Nifi Architecture
5
Draco integration in the FIWARE ecosystem
6
Basic Example
7
References
8
● FIWARE Catalogue
o https://www.fiware.org/developers/catalogue
● FIWARE Draco
o https://fiware-draco.readthedocs.io/en/latest
9
Cygnus
Cygnus
● What is it for?
● Cygnus is a connector in charge of persisting Orion context data in certain configured third-party
storages, creating a historical view of such data.
● How does it receives context data from Orion Context Broker?
● Cygnus uses the subscription/notification feature of Orion.
● A subscription is made in Orion on behalf of Cygnus, detailing which entities we want to be notified
when an update occurs on any of those entities attributes.
10
Cygnus
11
Cygnus
● Internally, Cygnus is based on Apache Flume, data collection and persistence agents.
● An agent is basically composed of
● a listener or source in charge of receiving the data,
● a channel where the source puts the data once it has been transformed into a Flume event,
● a sink, which takes Flume events from the channel in order to persist the data within its body into a
third-party storage.
12
Cygnus Architecture
● Cygnus runs Flume agents. Thus, Cygnus agents architecture is Flume agents one.
13
Data sinks
14
§ NGSI-like context data in:
§ HDFS, the Hadoop distributed file system.
§ MySQL, the well-know relational database manager.
§ CKAN, an Open Data platform.
§ MongoDB, the NoSQL document-oriented database.
§ STH Comet, a Short-Term Historic database built on top of MongoDB.
§ Kafka, the publish-subscribe messaging broker.
§ DynamoDB, a cloud-based NoSQL database by Amazon Web Services.
§ PostgreSQL, the well-know relational database manager.
§ CartoDB, the database specialized in geolocated data.
§ Twitter data in:
§ HDFS, the Hadoop distributed file system.
Cygnus events
15
§ A Source consumes Events having a specific format, and those Events are delivered to the Source by an
external source like a web server.
§ For example, an AvroSource can be used to receive Avro Events from clients or from other Flume agents
in the flow.
§ When a Source receives an Event, it stores it into one or more Channels.
§ The Channel is a passive store that holds the Event until that Event is consumed by a Sink.
§ One type of Channel available in Flume is the FileChannel which uses the local filesystem as its backing
store.
Cygnus events
16
§ A Sink is responsible for removing an Event from the Channel and puXng it into an external repository
like HDFS (in the case of an HDFSEventSink) or forwarding it to the Source at the next hop of the flow.
§ The Source and Sink within the given agent run asynchronously with the Events staged in the Channel.
Cygnus configuration example
17
§ https://github.com/telefonicaid/fiware-
cygnus/blob/master/doc/cygnus-
ngsi/installation_and_administration_guide/configurat
ion_examples.md
JVM
Source Channel Sink
Multiple persistence backends
18
JVM
Source Channel2 Sink2
Channel1 Sink1
Channel3 Sink3
Multiple agents
19
JVM2
Source2 Channel2 Sink2
JVMn
Sourcen Channeln Sinkn
JVM1
Source1 Channel1 Sink1
…
§ One instance for each Agent.
§ This add more capability to the
system.
Connecting Orion Context Broker and Cygnus
20
§ Subscription-notification mechanism of Orion Context Broker.
§ Cygnus needs to be notified each time certain entity's attributes change.
§ Therefore, Cygnus must subscribe to those entity's attribute changes.
Configure a basic Cygnus agent (Introduction)
21
§ Edit /usr/cygnus/conf/agent_<id>.conf
§ List of sources, channels and sinks:
§ cygnusagent.sources = http-source
§ cygnusagent.sinks = hdfs-sink
§ cygnusagent.channels = hdfs-channel
§ Channels configuration
§ cygnusagent.channels.hdfs-channel.type = memory
§ cygnusagent.channels.hdfs-channel.capacity = 1000
§ cygnusagent.channels.hdfs-channel.
§ transactionCapacity = 100
Configure a basic Cygnus agent (Sources)
22
§ Sources configuration:
§ cygnusagent.sources.http-source.channels = hdfs-channel
§ cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource
§ cygnusagent.sources.http-source.port = 5050
§ cygnusagent.sources.http-source.handler = es.tid.fiware.fiwareconnectors.cygnus.handlers.OrionRestHandler
§ cygnusagent.sources.http-source.handler.notification_target = /notify
§ cygnusagent.sources.http-source.handler.default_service = def_serv
§ cygnusagent.sources.http-source.handler.default_service_path = def_servpath
§ cygnusagent.sources.http-source.handler.events_ttl = 10
§ cygnusagent.sources.http-source.interceptors = ts de
§ cygnusagent.sources.http-source.interceptors.ts.type = timestamp
§ cygnusagent.sources.http-source.interceptors.de.type =
es.tid.fiware.fiwareconnectors.cygnus.interceptors.DestinationExtractor$Builder
§ cygnusagent.sources.http-source.interceptors.de.matching_table = /usr/cygnus/conf/matching_table.conf
Configure a basic Cygnus agent (Sinks)
23
§ Sinks configuration:
§ cygnusagent.sinks.hdfs-sink.channel = hdfs-channel
§ cygnusagent.sinks.hdfs-sink.type = es.tid.fiware.fiwareconnectors.cygnus.sinks.OrionHDFSSink
§ cygnusagent.sinks.hdfs-sink.cosmos_host = cosmos.lab.fi-ware.org
§ cygnusagent.sinks.hdfs-sink.cosmos_port = 14000
§ cygnusagent.sinks.hdfs-sink.cosmos_default_username = cosmos_username
§ cygnusagent.sinks.hdfs-sink.cosmos_default_password = xxxxxxxxxxxxx
§ cygnusagent.sinks.hdfs-sink.hdfs_api = httpfs
§ cygnusagent.sinks.hdfs-sink.attr_persistence = column
§ cygnusagent.sinks.hdfs-sink.hive_host = cosmos.lab.fi-ware.org
§ cygnusagent.sinks.hdfs-sink.hive_port = 10000
§ cygnusagent.sinks.hdfs-sink.krb5_auth = false
References
24
● FIWARE Catalogue
o https://www.fiware.org/developers/catalogue
● FIWARE Cygnus
o https://fiware-cygnus.readthedocs.io/en/latest
25
STH Comet
How? (… is not always the best)
§ The Context Broker only stores the latest
attribute values:
§ Event-driven action-oriented paradigm
§ The Short Time Historic adds memory into
the equation:
§ Continuous improvement paradigm
26
STH-COMET: What?
§ Time series database:
§ Optimized to deal with values indexed in time
§ Raw data vs. Aggregated data
§ Basic aggregation concepts:
o Range
o Resolution
o Origin
o Offset
27
How? (… is not always the best)
§ Collateral aspects to take into consideration:
§ Risk:
§ Maturity
§ Performance
§ Expertise
§ Flexibility (future evolution)
§ Current inversions
28
STH – Comet : How
(birds-eye functioning: minimal)
29
subscribeContext
update
notification
query (raw & aggregated)
Client
Orion
Context
Broker
STH – Comet : How
(birds-eye functioning: formal)
30
subscribeContext
update
notification
query (raw & aggregated)
Client
Orion
Context
Broker
Cygnus
Update
(raw & aggregated)
Architecture
31
Data schemas and pre-pagination
▪ Although the STH stores the evolution of (raw) data (i.e., attributes values) in time,
its real power comes from the storage of aggregated data
▪ The STH should be able to respond to queries such as:
• Give me the maximum temperature of this room during the last month (range)
aggregated by day (resolution)
• Give me the mean temperature of this room today (range) aggregated by hour or even
minute (resolution)
• Give me the standard deviation of the temperature of this room this last year (range)
aggregated by day (resolution)
• Give me the number of times the air conditioner of this room was switched on or off last
Monday (range) aggregated by hour
32
Data schemas and pre-aggregation
33
API: get raw data
34
Pagination
35
Response
36
Aggregated data retrieval
37
Response
38
Attribute data removal
39
Log level retrieval and update
40
References
41
● FIWARE Catalogue
o https://www.fiware.org/developers/catalogue
● FIWARE STH-Comet
o https://fiware-sth-comet.readthedocs.io/en/latest
42
QuantumLeap: Managing the Stream of Context
Information History using Time Series DBs
Why QuantumLeap
§ Provide historical data support for NGSIv2 data
§ Leverage on an efficient time-series database
§ Deploy and scale it easily on containerized environments
43
Data is no-more mono dimensional
§ The attribute
§ Temperature is 20
§ The history of the attribute
§ Temperature is 20 on 19th May 8:59:01.020 AM CEST
§ Temperature is 21 on 19th May 9:12:03.045 AM CEST
§ The geo-localisation of the attribute
§ Temperature is 20 in 41°51'16.8"N 12°28'15.0"E
44 Value
Value in time
Value
in
space
The core of the solution
45
Quantum
Leap
Architecture Overview
46
Context
Broker
Quantum
Leap
CrateDB Grafana
/v2/subscribe
/v2/notify
1
/v2/entities2
3
Spark
/v2/notify
My Analytic
service
Step 1: Extract
§ QuantumLeap:
§ Needs to know where CrateDB is
§ Crate:
§ Needs a volume to persist data
§ Grafana:
§ Needs `crate-datasource`
§ (or `PostgreSQL`) plugin
47
QuantumLeap in 4 steps
Step 2: “Connect” to Orion Context Broker
§ Create a Subscription in Orion CB for the entities you are interested in!
§ A) Do it directly talking to Orion
§ https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html#subscriptions
§ B) Or ask QuantumLeap to do it for you
§ https://app.swaggerhub.com/apis/smartsdk/ngsi-tsdb/0.1.1#/input/reporter.reporter.subscribe
§ More info:
§ https://quantumleap.readthedocs.io/en/latest/user/#orion-subscription
48
Step 2: “Connect” to Orion Context Broker
§ POST orion/v2/subscriptions/
§ Note notification url must be a
valid url for Orion container.
§ Note the inclusion of
dateModified
§ Use the same insertion headers
§ FIWARE-service
§ FIWARE-servicepath
49
{
"description": "Notify QuantumLeap on luminosity changes on any Lamp",
"subject": {
"entities": [
{
"idPattern": "Lamp.*"
}
],
"condition": {
"attrs": [
"luminosity"
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"attrs": [
"luminosity"
],
"metadata": ["dateCreated", "dateModified"]
},
"throttling": 1
}
Step 3: Get your data
§ Check you are sending data to
Orion
§ Check Orion notifications did not
fail
§ GET orion/v2/subscriptions
§ Get your data
§ Nothing?
§ Checkout QuantumLeap logs!
50
# REQUEST
curl -X GET 
'http://localhost:8668/v2/entities/Lamp:001/attrs/luminosity?=3&limit=3' 
-H 'Accept: application/json' 
-H 'Fiware-Service: openiot' 
-H 'Fiware-ServicePath: /’
# RESPONSE
{
"data": {
"attrName": "luminosity",
"entityId": "Lamp:001",
"index": [
"2018-10-29T14:27:26",
"2018-10-29T14:27:28",
"2018-10-29T14:27:29"
],
"values": [
2000,
1991,
1998
]
}
}
Step 3: Get your data
51
1. Create a Grafana data-source for each entity type
2. Create Grafana dashboards using your datasource
Step 4: Prepare your Dashboards
52
References
53
● FIWARE Catalogue
o https://www.fiware.org/developers/catalogue
● Tutorial
o https://fiware-tutorials.readthedocs.io/en/latest/time-series-data/index.html
● Code
o https://github.com/smartsdk/ngsi-timeseries-api
● Docs
o https://quantumleap.readthedocs.io/en/latest
● API
o https://app.swaggerhub.com/apis/smartsdk/ngsi-tsdb
Question & Answer
54
fiware-tech-help@lists.fiware.org
http://fiware.org
Follow @FIWARE on Twitter
5
6

More Related Content

PDF
FIWARE Training: JSON-LD and NGSI-LD
PDF
Data Modeling with NGSI, NGSI-LD
PDF
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
PPTX
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
PDF
FIWARE Tech Summit - FIWARE Cygnus and STH-Comet
PPTX
FIWARE 概要 - FIWARE WednesdayWebinars
PDF
Big Data and Machine Learning with FIWARE
PPTX
FIWARE Wednesday Webinars - Core Context Management
FIWARE Training: JSON-LD and NGSI-LD
Data Modeling with NGSI, NGSI-LD
FIWARE Global Summit - NGSI-LD – an Evolution from NGSIv2
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 3.7.0対応)
FIWARE Tech Summit - FIWARE Cygnus and STH-Comet
FIWARE 概要 - FIWARE WednesdayWebinars
Big Data and Machine Learning with FIWARE
FIWARE Wednesday Webinars - Core Context Management

What's hot (20)

PDF
Kong, Keyrock, Keycloak, i4Trust - Options to Secure FIWARE in Production
PPTX
FIWAREシステム内の短期履歴の管理
PDF
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.2.0対応)
PDF
Creating a Context-Aware solution, Complex Event Processing with FIWARE Perseo
PPTX
FIWARE Wednesday Webinars - How to Design DataModels
PPTX
Fiware IoT_IDAS_intro_ul20_v2
PDF
FIWARE Global Summit - The Scorpio NGSI-LD Broker: Features and Supported Arc...
PPTX
FIWARE and Smart Data Models
PDF
FIWARE Training: NGSI-LD Advanced Operations
PDF
FIWARE Wednesday Webinars - Introduction to NGSI-LD
PDF
Kafka Streams: What it is, and how to use it?
PDF
IoT時代におけるストリームデータ処理と急成長の Apache Flink
PDF
ksqlDB: A Stream-Relational Database System
PPTX
FIWARE Wednesday Webinars - FIWARE Overview
PDF
Getting Started with Confluent Schema Registry
PPTX
FIWARE Big Data Ecosystem : Cygnus
PDF
NetflixにおけるPresto/Spark活用事例
PPTX
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
PPTX
Prometheus入門から運用まで徹底解説
PPTX
FAPI and beyond - よりよいセキュリティのために
Kong, Keyrock, Keycloak, i4Trust - Options to Secure FIWARE in Production
FIWAREシステム内の短期履歴の管理
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.2.0対応)
Creating a Context-Aware solution, Complex Event Processing with FIWARE Perseo
FIWARE Wednesday Webinars - How to Design DataModels
Fiware IoT_IDAS_intro_ul20_v2
FIWARE Global Summit - The Scorpio NGSI-LD Broker: Features and Supported Arc...
FIWARE and Smart Data Models
FIWARE Training: NGSI-LD Advanced Operations
FIWARE Wednesday Webinars - Introduction to NGSI-LD
Kafka Streams: What it is, and how to use it?
IoT時代におけるストリームデータ処理と急成長の Apache Flink
ksqlDB: A Stream-Relational Database System
FIWARE Wednesday Webinars - FIWARE Overview
Getting Started with Confluent Schema Registry
FIWARE Big Data Ecosystem : Cygnus
NetflixにおけるPresto/Spark活用事例
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
Prometheus入門から運用まで徹底解説
FAPI and beyond - よりよいセキュリティのために
Ad

Similar to Data persistency (draco, cygnus, sth comet, quantum leap) (20)

PPTX
Centralized logging with Flume
PDF
OSSNA Building Modern Data Streaming Apps
PPTX
Deploying Apache Flume to enable low-latency analytics
PPTX
PPTX
Apache flume - an Introduction
PPTX
Spark+flume seattle
PDF
Budapest Data/ML - Building Modern Data Streaming Apps with NiFi, Flink and K...
PDF
WarsawITDays_ ApacheNiFi202
PDF
InfluxEnterprise Architectural Patterns by Dean Sheehan, Senior Director, Pre...
PPTX
Flume basic
PDF
(Current22) Let's Monitor The Conditions at the Conference
PDF
Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...
PDF
Automating Research Data Management at Scale with Globus
PDF
Базы данных. ZooKeeper
PDF
OSCON 15 Building Opensource wtih Open Source
PDF
Real time cloud native open source streaming of any data to apache solr
PDF
Java Full Stack Interview Questions – 3 to 5 Years.pdf
PDF
Java Full Stack Interview Questions – 3 to 5 Years.pdf
PPTX
Real-Time Distributed and Reactive Systems with Apache Kafka and Apache Accumulo
PPTX
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Centralized logging with Flume
OSSNA Building Modern Data Streaming Apps
Deploying Apache Flume to enable low-latency analytics
Apache flume - an Introduction
Spark+flume seattle
Budapest Data/ML - Building Modern Data Streaming Apps with NiFi, Flink and K...
WarsawITDays_ ApacheNiFi202
InfluxEnterprise Architectural Patterns by Dean Sheehan, Senior Director, Pre...
Flume basic
(Current22) Let's Monitor The Conditions at the Conference
Let’s Monitor Conditions at the Conference With Timothy Spann & David Kjerrum...
Automating Research Data Management at Scale with Globus
Базы данных. ZooKeeper
OSCON 15 Building Opensource wtih Open Source
Real time cloud native open source streaming of any data to apache solr
Java Full Stack Interview Questions – 3 to 5 Years.pdf
Java Full Stack Interview Questions – 3 to 5 Years.pdf
Real-Time Distributed and Reactive Systems with Apache Kafka and Apache Accumulo
Accumulo Summit 2015: Real-Time Distributed and Reactive Systems with Apache ...
Ad

More from Fernando Lopez Aguilar (20)

PDF
Introduction to FIWARE technology
PDF
DW2020 Data Models - FIWARE Platform
PPTX
How to deploy a smart city platform?
PPTX
Building the Smart City Platform on FIWARE Lab
PDF
FIWARE and Robotics
PDF
Operational Dashboards with FIWARE WireCloud
PDF
FIWARE Identity Management and Access Control
PDF
How to debug IoT Agents
PDF
Core Context Management
PDF
What is an IoT Agent
PDF
FIWARE Overview
PDF
Overview of the FIWARE Ecosystem
PPTX
Cloud and Big Data in the agriculture sector
PDF
Berlin OpenStack Summit'18
PPTX
Context Information Management in IoT enabled smart systems - the basics
PPTX
FIWARE IoT Introduction 1
PPTX
Introduction to FIWARE IoT
PPTX
Setting up your virtual infrastructure using FIWARE Lab Cloud
PDF
Connecting to the internet of things (IoT)
PPTX
Fiware, the future internet
Introduction to FIWARE technology
DW2020 Data Models - FIWARE Platform
How to deploy a smart city platform?
Building the Smart City Platform on FIWARE Lab
FIWARE and Robotics
Operational Dashboards with FIWARE WireCloud
FIWARE Identity Management and Access Control
How to debug IoT Agents
Core Context Management
What is an IoT Agent
FIWARE Overview
Overview of the FIWARE Ecosystem
Cloud and Big Data in the agriculture sector
Berlin OpenStack Summit'18
Context Information Management in IoT enabled smart systems - the basics
FIWARE IoT Introduction 1
Introduction to FIWARE IoT
Setting up your virtual infrastructure using FIWARE Lab Cloud
Connecting to the internet of things (IoT)
Fiware, the future internet

Recently uploaded (20)

PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
PptxGenJS_Demo_Chart_20250317130215833.pptx
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPTX
artificial intelligence overview of it and more
PPTX
Introduction to Information and Communication Technology
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
SAP Ariba Sourcing PPT for learning material
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PDF
Introduction to the IoT system, how the IoT system works
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
PPTX
Digital Literacy And Online Safety on internet
Unit-1 introduction to cyber security discuss about how to secure a system
Job_Card_System_Styled_lorem_ipsum_.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PptxGenJS_Demo_Chart_20250317130215833.pptx
Module 1 - Cyber Law and Ethics 101.pptx
artificial intelligence overview of it and more
Introduction to Information and Communication Technology
WebRTC in SignalWire - troubleshooting media negotiation
The New Creative Director: How AI Tools for Social Media Content Creation Are...
SAP Ariba Sourcing PPT for learning material
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Design_with_Watersergyerge45hrbgre4top (1).ppt
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
Introduction to the IoT system, how the IoT system works
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
How to Ensure Data Integrity During Shopify Migration_ Best Practices for Sec...
Digital Literacy And Online Safety on internet

Data persistency (draco, cygnus, sth comet, quantum leap)

  • 1. Session 5 - Data Persistency (Draco, Cygnus, STH Comet, Quantum Leap) Fernando López, Cloud & Platform Senior Expert fernando.lopez@fiware.org @flopezaguilar FIWARE Foundation, e.V.
  • 2. Learning Goals 1 ● What is Data Persistrency? ● What is a Time Series Database? ● What is the different between Cygnus and Draco compares with Quantum Leap and STH-Comet? ● Which main technology is behind is solution?
  • 3. 2 Draco: Persisting Context Data to MongoDB
  • 4. Draco GE ▪ Ingestion and persistency of data ▪ Easy to use, powerful, and reliable system for processing and distributing data ▪ Based on Apache NiFi, dataflow system based on the concepts of flow-based programming ▪ Support powerful and scalable directed graphs of data routing, transformation, and system mediation logic ▪ Built to automate the flow of data between systems 3
  • 5. Features ● NGSIv2 Support both for ingestion and serialization to have full integration with the Orion Context Broker. ● Several persistent backends : ● MySQL, the well-know relaEonal database manager. ● MongoDB, the NoSQL document-oriented database. ● PostgreSQL, the well-know relaEonal database manager. ● HDFS, Hadoop distributed file system. ● Cassandra, Distributed database. ● CartoDB, for geospaEal Data ● Templates for some common scenarios ● Rest API 4
  • 7. Draco integration in the FIWARE ecosystem 6
  • 9. References 8 ● FIWARE Catalogue o https://www.fiware.org/developers/catalogue ● FIWARE Draco o https://fiware-draco.readthedocs.io/en/latest
  • 11. Cygnus ● What is it for? ● Cygnus is a connector in charge of persisting Orion context data in certain configured third-party storages, creating a historical view of such data. ● How does it receives context data from Orion Context Broker? ● Cygnus uses the subscription/notification feature of Orion. ● A subscription is made in Orion on behalf of Cygnus, detailing which entities we want to be notified when an update occurs on any of those entities attributes. 10
  • 13. Cygnus ● Internally, Cygnus is based on Apache Flume, data collection and persistence agents. ● An agent is basically composed of ● a listener or source in charge of receiving the data, ● a channel where the source puts the data once it has been transformed into a Flume event, ● a sink, which takes Flume events from the channel in order to persist the data within its body into a third-party storage. 12
  • 14. Cygnus Architecture ● Cygnus runs Flume agents. Thus, Cygnus agents architecture is Flume agents one. 13
  • 15. Data sinks 14 § NGSI-like context data in: § HDFS, the Hadoop distributed file system. § MySQL, the well-know relational database manager. § CKAN, an Open Data platform. § MongoDB, the NoSQL document-oriented database. § STH Comet, a Short-Term Historic database built on top of MongoDB. § Kafka, the publish-subscribe messaging broker. § DynamoDB, a cloud-based NoSQL database by Amazon Web Services. § PostgreSQL, the well-know relational database manager. § CartoDB, the database specialized in geolocated data. § Twitter data in: § HDFS, the Hadoop distributed file system.
  • 16. Cygnus events 15 § A Source consumes Events having a specific format, and those Events are delivered to the Source by an external source like a web server. § For example, an AvroSource can be used to receive Avro Events from clients or from other Flume agents in the flow. § When a Source receives an Event, it stores it into one or more Channels. § The Channel is a passive store that holds the Event until that Event is consumed by a Sink. § One type of Channel available in Flume is the FileChannel which uses the local filesystem as its backing store.
  • 17. Cygnus events 16 § A Sink is responsible for removing an Event from the Channel and puXng it into an external repository like HDFS (in the case of an HDFSEventSink) or forwarding it to the Source at the next hop of the flow. § The Source and Sink within the given agent run asynchronously with the Events staged in the Channel.
  • 18. Cygnus configuration example 17 § https://github.com/telefonicaid/fiware- cygnus/blob/master/doc/cygnus- ngsi/installation_and_administration_guide/configurat ion_examples.md JVM Source Channel Sink
  • 19. Multiple persistence backends 18 JVM Source Channel2 Sink2 Channel1 Sink1 Channel3 Sink3
  • 20. Multiple agents 19 JVM2 Source2 Channel2 Sink2 JVMn Sourcen Channeln Sinkn JVM1 Source1 Channel1 Sink1 … § One instance for each Agent. § This add more capability to the system.
  • 21. Connecting Orion Context Broker and Cygnus 20 § Subscription-notification mechanism of Orion Context Broker. § Cygnus needs to be notified each time certain entity's attributes change. § Therefore, Cygnus must subscribe to those entity's attribute changes.
  • 22. Configure a basic Cygnus agent (Introduction) 21 § Edit /usr/cygnus/conf/agent_<id>.conf § List of sources, channels and sinks: § cygnusagent.sources = http-source § cygnusagent.sinks = hdfs-sink § cygnusagent.channels = hdfs-channel § Channels configuration § cygnusagent.channels.hdfs-channel.type = memory § cygnusagent.channels.hdfs-channel.capacity = 1000 § cygnusagent.channels.hdfs-channel. § transactionCapacity = 100
  • 23. Configure a basic Cygnus agent (Sources) 22 § Sources configuration: § cygnusagent.sources.http-source.channels = hdfs-channel § cygnusagent.sources.http-source.type = org.apache.flume.source.http.HTTPSource § cygnusagent.sources.http-source.port = 5050 § cygnusagent.sources.http-source.handler = es.tid.fiware.fiwareconnectors.cygnus.handlers.OrionRestHandler § cygnusagent.sources.http-source.handler.notification_target = /notify § cygnusagent.sources.http-source.handler.default_service = def_serv § cygnusagent.sources.http-source.handler.default_service_path = def_servpath § cygnusagent.sources.http-source.handler.events_ttl = 10 § cygnusagent.sources.http-source.interceptors = ts de § cygnusagent.sources.http-source.interceptors.ts.type = timestamp § cygnusagent.sources.http-source.interceptors.de.type = es.tid.fiware.fiwareconnectors.cygnus.interceptors.DestinationExtractor$Builder § cygnusagent.sources.http-source.interceptors.de.matching_table = /usr/cygnus/conf/matching_table.conf
  • 24. Configure a basic Cygnus agent (Sinks) 23 § Sinks configuration: § cygnusagent.sinks.hdfs-sink.channel = hdfs-channel § cygnusagent.sinks.hdfs-sink.type = es.tid.fiware.fiwareconnectors.cygnus.sinks.OrionHDFSSink § cygnusagent.sinks.hdfs-sink.cosmos_host = cosmos.lab.fi-ware.org § cygnusagent.sinks.hdfs-sink.cosmos_port = 14000 § cygnusagent.sinks.hdfs-sink.cosmos_default_username = cosmos_username § cygnusagent.sinks.hdfs-sink.cosmos_default_password = xxxxxxxxxxxxx § cygnusagent.sinks.hdfs-sink.hdfs_api = httpfs § cygnusagent.sinks.hdfs-sink.attr_persistence = column § cygnusagent.sinks.hdfs-sink.hive_host = cosmos.lab.fi-ware.org § cygnusagent.sinks.hdfs-sink.hive_port = 10000 § cygnusagent.sinks.hdfs-sink.krb5_auth = false
  • 25. References 24 ● FIWARE Catalogue o https://www.fiware.org/developers/catalogue ● FIWARE Cygnus o https://fiware-cygnus.readthedocs.io/en/latest
  • 27. How? (… is not always the best) § The Context Broker only stores the latest attribute values: § Event-driven action-oriented paradigm § The Short Time Historic adds memory into the equation: § Continuous improvement paradigm 26
  • 28. STH-COMET: What? § Time series database: § Optimized to deal with values indexed in time § Raw data vs. Aggregated data § Basic aggregation concepts: o Range o Resolution o Origin o Offset 27
  • 29. How? (… is not always the best) § Collateral aspects to take into consideration: § Risk: § Maturity § Performance § Expertise § Flexibility (future evolution) § Current inversions 28
  • 30. STH – Comet : How (birds-eye functioning: minimal) 29 subscribeContext update notification query (raw & aggregated) Client Orion Context Broker
  • 31. STH – Comet : How (birds-eye functioning: formal) 30 subscribeContext update notification query (raw & aggregated) Client Orion Context Broker Cygnus Update (raw & aggregated)
  • 33. Data schemas and pre-pagination ▪ Although the STH stores the evolution of (raw) data (i.e., attributes values) in time, its real power comes from the storage of aggregated data ▪ The STH should be able to respond to queries such as: • Give me the maximum temperature of this room during the last month (range) aggregated by day (resolution) • Give me the mean temperature of this room today (range) aggregated by hour or even minute (resolution) • Give me the standard deviation of the temperature of this room this last year (range) aggregated by day (resolution) • Give me the number of times the air conditioner of this room was switched on or off last Monday (range) aggregated by hour 32
  • 34. Data schemas and pre-aggregation 33
  • 35. API: get raw data 34
  • 41. Log level retrieval and update 40
  • 42. References 41 ● FIWARE Catalogue o https://www.fiware.org/developers/catalogue ● FIWARE STH-Comet o https://fiware-sth-comet.readthedocs.io/en/latest
  • 43. 42 QuantumLeap: Managing the Stream of Context Information History using Time Series DBs
  • 44. Why QuantumLeap § Provide historical data support for NGSIv2 data § Leverage on an efficient time-series database § Deploy and scale it easily on containerized environments 43
  • 45. Data is no-more mono dimensional § The attribute § Temperature is 20 § The history of the attribute § Temperature is 20 on 19th May 8:59:01.020 AM CEST § Temperature is 21 on 19th May 9:12:03.045 AM CEST § The geo-localisation of the attribute § Temperature is 20 in 41°51'16.8"N 12°28'15.0"E 44 Value Value in time Value in space
  • 46. The core of the solution 45 Quantum Leap
  • 48. Step 1: Extract § QuantumLeap: § Needs to know where CrateDB is § Crate: § Needs a volume to persist data § Grafana: § Needs `crate-datasource` § (or `PostgreSQL`) plugin 47 QuantumLeap in 4 steps
  • 49. Step 2: “Connect” to Orion Context Broker § Create a Subscription in Orion CB for the entities you are interested in! § A) Do it directly talking to Orion § https://fiware-orion.readthedocs.io/en/master/user/walkthrough_apiv2/index.html#subscriptions § B) Or ask QuantumLeap to do it for you § https://app.swaggerhub.com/apis/smartsdk/ngsi-tsdb/0.1.1#/input/reporter.reporter.subscribe § More info: § https://quantumleap.readthedocs.io/en/latest/user/#orion-subscription 48
  • 50. Step 2: “Connect” to Orion Context Broker § POST orion/v2/subscriptions/ § Note notification url must be a valid url for Orion container. § Note the inclusion of dateModified § Use the same insertion headers § FIWARE-service § FIWARE-servicepath 49 { "description": "Notify QuantumLeap on luminosity changes on any Lamp", "subject": { "entities": [ { "idPattern": "Lamp.*" } ], "condition": { "attrs": [ "luminosity" ] } }, "notification": { "http": { "url": "http://quantumleap:8668/v2/notify" }, "attrs": [ "luminosity" ], "metadata": ["dateCreated", "dateModified"] }, "throttling": 1 }
  • 51. Step 3: Get your data § Check you are sending data to Orion § Check Orion notifications did not fail § GET orion/v2/subscriptions § Get your data § Nothing? § Checkout QuantumLeap logs! 50 # REQUEST curl -X GET 'http://localhost:8668/v2/entities/Lamp:001/attrs/luminosity?=3&limit=3' -H 'Accept: application/json' -H 'Fiware-Service: openiot' -H 'Fiware-ServicePath: /’ # RESPONSE { "data": { "attrName": "luminosity", "entityId": "Lamp:001", "index": [ "2018-10-29T14:27:26", "2018-10-29T14:27:28", "2018-10-29T14:27:29" ], "values": [ 2000, 1991, 1998 ] } }
  • 52. Step 3: Get your data 51
  • 53. 1. Create a Grafana data-source for each entity type 2. Create Grafana dashboards using your datasource Step 4: Prepare your Dashboards 52
  • 54. References 53 ● FIWARE Catalogue o https://www.fiware.org/developers/catalogue ● Tutorial o https://fiware-tutorials.readthedocs.io/en/latest/time-series-data/index.html ● Code o https://github.com/smartsdk/ngsi-timeseries-api ● Docs o https://quantumleap.readthedocs.io/en/latest ● API o https://app.swaggerhub.com/apis/smartsdk/ngsi-tsdb
  • 57. 5 6