Successfully reported this slideshow.
Your SlideShare is downloading. ×

Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Envoy and Kafka
Envoy and Kafka
Loading in …3
×

Check these out next

1 of 31 Ad

Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta

Download to read offline

In this InfluxDays NYC 2019 talk, InfluxData Developer Advocate Sonia Gupta will provide an introduction to InfluxDB 2.0 and a review of the new features. She will demonstrate how to install it, insert data, and build your first Flux query.

In this InfluxDays NYC 2019 talk, InfluxData Developer Advocate Sonia Gupta will provide an introduction to InfluxDB 2.0 and a review of the new features. She will demonstrate how to install it, insert data, and build your first Flux query.

Advertisement
Advertisement

More Related Content

Slideshows for you (20)

Similar to Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta (20)

Advertisement

More from InfluxData (20)

Recently uploaded (20)

Advertisement

Intro to InfluxDB 2.0 and Your First Flux Query by Sonia Gupta

  1. 1. Sonia Gupta / Developer Advocate Introduction to InfluxDB 2.0 and Your First Flux Query
  2. 2. © 2018 InfluxData. All rights reserved.2 Agenda Basic Concepts ● Brief Overview of New Features in InfluxDB 2.0 ● What is Flux? Usage ● Installing InfluxDB 2.0 ● Building a basic flux query ● Using Flux in the 2.0 UI and Chronograf in 1.7
  3. 3. 1.x and The TICK Stack
  4. 4. © 2018 InfluxData. All rights reserved.4 InfluxDB: The Modern Time Series Database • Time-series database built from the ground up to handle high write & query loads • Custom high performance data store written specifically for time- stamped data, (DevOps monitoring, application metrics, IoT sensor data, & real-time analytics) • Offers a SQL-like query language for interacting with data (InfluxQL) • Now offers Flux for interacting with data!
  5. 5. © 2018 InfluxData. All rights reserved.5 ● It was hard to add feature requests to InfluxQL, Flux now has more functionality than InfluxQL. ● TICK Script difficult to learn and debug. ● Creating a single binary means a better user experience when the UI is part of the database. Why develop Flux and InfluxDB 2.0?
  6. 6. InfluxDB 2.0
  7. 7. © 2018 InfluxData. All rights reserved.7 ● The UI is very different. You have a wizard to build out scripts in 1.x, whereas you have a visual query builder in 2.0. ● Changed visualizations, can switch between them using dropdown instead of going to a separate page. ● Dedicated API layer within the system so the UI works against that layer, and it’s the same between OSS, Cloud, and Enterprise. What’s New in InfluxDB 2.0
  8. 8. © 2018 InfluxData. All rights reserved.8 ● Single Binary - don’t need to deploy external software if you don’t want to. ● Native Prometheus endpoint that exposes our metrics in Prometheus data format - localhost:9999/metrics ● Tasks are a brand new concept - Flux queries that can be scheduled, can be used to analyze data over period of time similar to CQs. ● Tokens - you can give access to third party systems to write or read data from the system. What’s New in InfluxDB 2.0
  9. 9. © 2018 InfluxData. All rights reserved.9 ● Organizations are a workspace for your team to share dashboards and queries, as well as a bucket. ● Telegraf agent configuration in the UI itself. ● Can upload data in Line Protocol from the browser. What’s New in InfluxDB 2.0
  10. 10. Demo of InfluxDB 2.0
  11. 11. Flux
  12. 12. © 2018 InfluxData. All rights reserved.12 Flux is a functional data scripting and query language • Written to be: – Useable • easy to learn – Readable • developers read more code than we write – Composeable • developers can build onto the language – Testable • queries are code – Contributable • open source contributions matter – Shareable • developers read more code than we write – Composeable What Is Flux?Flux?
  13. 13. © 2018 InfluxData. All rights reserved.13 ■ Flux is an alternative to InfluxQL with additional functionality like: ● Joins ● Math across measurements ● Sort by any column ● Pivot ● Histograms ● Covariance • Reference: https://docs.influxdata.com/flux/v0.7/introduction/flux-vs-influxql/#influxql-and-flux-parity ■ developers read more code than we write ○ Composeable Flux and InfluxQL
  14. 14. © 2018 InfluxData. All rights reserved.14 • Key terms and terminology – Bucket: Named data source with retention policy – Pipe-forward operator: chain operations together, |> – Table: data is returned in annotated CSVs, represented as tables – Group Key: list of columns for which every row in the table has the same value • Reference:https://docs.influxdata.com/flux/v0.7/introduction/getting-started/ Concepts
  15. 15. Basic Flux Queries
  16. 16. © 2018 InfluxData. All rights reserved.16 • Every Flux query needs: – data source – time range – data filters Basic Flux Queries
  17. 17. © 2019 InfluxData. All rights reserved.17 Basic Flux Queries Step 1: Data Source from(bucket:"telegraf/autogen") Reference: data source database retention policy
  18. 18. © 2019 InfluxData. All rights reserved.18 Basic Flux Queries Step 2: Time Range from(bucket:"telegraf/autogen") |> range(start: -1h) relative time range
  19. 19. © 2019 InfluxData. All rights reserved.19 Basic Flux Queries Step 3: Data Filters from(bucket:"telegraf/autogen") |> range(start: -1h) |> filter(fn: (r) => r.measurement == “cpu” relative time range Data Filters
  20. 20. © 2019 InfluxData. All rights reserved.20 Basic Flux Queries • Every Flux query needs: – data source – time range – data filters from(bucket:"telegraf/autogen") |> range(start: -1h) |> filter(fn: (r) => r.measurement == “cpu” AND r.field == “usage_system” AND r.cpu == “cpu_total”
  21. 21. © 2019 InfluxData. All rights reserved.21 Basic Flux Queries - Note • Use Flux’s yield() function to output the filtered tables as the result of the query • Chronograf and Influx CLI automatically assume a yield() from(bucket:"telegraf/autogen") |> range(start: -1h) |> filter(fn: (r) => r.measurement == “cpu” AND r.field == “usage_system” AND r.cpu == “cpu_total” |> yield()
  22. 22. © 2018 InfluxData. All rights reserved.22 Flux functions can be split across four major boundaries: 1) Input functions (read from a source like InfluxDB) 2) Functions that combine or split apart tables in the resulting stream (group, join, window) 3) Functions that get applied to each table in a stream (aggregates, selectors, sorting) 4) Output functions that send the result to a data sync • developers read more code than we write – Composeable Four Major Boundaries
  23. 23. © 2018 InfluxData. All rights reserved.23 • Input – from() • Output – yield() • Transformation – aggregates • mean(), count(), etc – selectors • first(), last(), max(), min(), etc – many more • Miscellaneous – systemTime() • Custom • developers read more code than we write – Composeable • developers can build onto the language Flux Functions
  24. 24. Flux in the CLI
  25. 25. © 2019 InfluxData. All rights reserved.25 CLI in “Flux” mode Any Flux query can be executed in the REPL $ ./influx repl -o <organization name>
  26. 26. © 2019 InfluxData. All rights reserved.26 CLI in “Flux” mode Any Flux query can be executed in the REPL $> from(bucket:"telegraf/autogen")|> range(start: -15m)|> filter(fn: (r) => r._measurement == "cpu")
  27. 27. Demo of Flux in the 2.0 UI
  28. 28. Demo of Flux in 1.7
  29. 29. © 2018 InfluxData. All rights reserved.29 Start with Flux Installation ● Flux is packaged with InfluxDB v1.7+ without further installation needed ● InfluxData Sandbox (Docker container) ● Flux is in technical preview (no prod) InfluxDB Configuration ● Set `flux-enabled = true` Help ● https://community.influxdata.com/c/fluxlang
  30. 30. Thank You!

×