Get Started with Flux
Flux is InfluxData's new data language designed for querying, analyzing, and acting on data stored in InfluxDB. Its takes the power of InfluxQL and the TICKscript and combines them into a single, unified data scripting language.
Setup Flux from scratch
Setting up the TICK stack with Flux is pretty simple. If you're using the InfluxData Sandbox, it's even simpler. For instructions on using Flux with the Sandbox, skip down.
Install Chronograf and InfluxDB Nightlies
Download the nightly builds Chronograf, and InfluxDB to get the most recent versions that include Flux and Flux-dependent
Nightly builds for each are available on the InfluxData Downloads page.
Once downloaded and unpackaged, move the binaries into your system's
Configure the storage service on InfluxDB
InfluxDB stores its data within a Time-Structured Merge Tree (TSM) format. However, there are two potential indicies
with the underlying TSM file format. The default
inmem or in-memory. Upon startup, the TSM files are
read and the in-memory index is rebuilt.
There second option is to use the Time Series Index (TSI) engine, which stores indexed data on disk.
If you are starting from scracth, update your the
index-version setting under the
[data] section in your
influxdb.conf to use
# ... [data] # ... index-version = "tsi1" # ...
If you already have been running InfluxDB and have data that you wish to maintain and use, you need to convert your existing TSM-based shards to TSI-supported shards.
influx_inspect buildtsi for converting your TSM-based shards to TSI-based shards. You can read more about using building TSI here.
Start InfluxDB and Chronograf
InfluxDB and Chronograf are all run as separate daemonized processes and must be started separately. Run each of the following commands in their own terminal sessions.
# Start the influxd daemon influxd -config path/to/influxdb.conf
# Start Chronograf chronograf
Open Chronograf in your browser of choice at localhost:8888.
Select the wrench icon in the left-hand navigation bar which is the Configuration option. The following screen should appear:
Connect to InfluxDB
If not already connected to InfluxDB, you will be prompted for connection details. Provide the necessary credentials and save.
Connect to Flux
To connect Chronograf to the Flux engine within the InfluxDB OSS instance, click on the Flux Editor icon in the left navigation.
Ensure the URL of the InfluxDB OSS instance is used -- and append that with the
For example, if you are running InfluxDB on your local machine and using
http://localhost:8086 to interact with InfluxDB,
the Flux URL should be:
Once the connection is established, the Flux Editor is available from the Data Explorer and when defining cells within a Dashboard. Keep in mind that BOTH InfluxQL and Flux can be used within InfluxDB 1.7.
Using Flux with the Sandbox
To use Flux with the InfluxData Sandbox,
start the Sandbox with the
-nightly flag to pull the nightly builds of InfluxDB and
./sandbox up -nightly
Get started with the Flux Editor
The Flux Editor makes working with Flux a visual process. It consists of 3 panes:
- The Script Editor Where the actual Flux code is written and displayed.
- The Flux Builder A visual representation of your Flux script used to visualize and build your script.
- The Schema Explorer Allows you to explore the actual structure of your data as you're building Flux scripts.
Each pane can be minimized, maximized, or closed depending on how you want to work.
Flux queries are written in the "Script" pane of the Flux Editor. You can also use the Flux Builder to visually build out queries. As queries are updated in the Flex Builder, the are updated in the script editor.
The "Explore" pane of the Flux Editor allows you to visual explore the structure of your data. This is incredibly helpful as you're building out Flux queries.
The "Build" pane is a visual representation of your Flux script that used to both visualize and build your script.
As queries are updated in the Flex Builder, the are updated in the script editor.
At any point in your Flux query, you can use the
yield() function to visualize the current state of your query.
Learn the basics of the Flux language
Flux draws inspiration from programming languages such as Lisp, Elixir, Elm,
For an introduction into the Flux syntax, view the
section in the Flux project