Testdrive of InfluxData OSS 2.0

Introduction

Despite it will be arriving soon in mainline as there is a schedule for the InfluxDB Master Branch to Switch to 2.0 on Jan 11 | InfluxData (thanks @weef), we are all eager to check out Flux (formerly IFQL), the new InfluxDB data language, which we already mentioned at The history and future of InfluxDB and Temperatursummen in der Imkerei.

The »InfluxData Platform, a.k.a. Influx 2.0 OSS« instance we will be spinning up is primarily for supporting @weef and @wtf in their endeavors regarding advanced timeseries data crunching. However, everyone who is interested to get their hands dirty is invited to ask us for an account.

Building

Let’s just try to build the »InfluxData Platform, a.k.a. Influx 2.0 OSS« from its monorepo on a contemporary Debian machine able to install go-1.11 from Debian buster (testing), as

This project requires Go 1.11 and Go module support.

https://github.com/influxdata/platform

Install prerequisites

# Just gives us go-1.10
# apt install golang -t stretch-backports

# Will give us go-1.11
apt install golang protobuf-compiler gogoprotobuf -t buster

# Bazaar
apt install bzr

Acquire sources and run build

git clone https://github.com/influxdata/platform /opt/influxdata-platform
cd /opt/influxdata-platform

export TEMPDIR=/var/tmp
make all

Test drive

make run
             ._ o o
             \_`-)|_
          ,""      _\_
        ,"  ## |   0 0.
      ," ##   ,-\__    `.
    ,"       /     `--._;) - "HAI, I'm Chronogiraffe. Let's be friends!"
  ,"     ## /
,"   ##    /
./bin/linux/influxd --developer-mode=true
1 Like

Running (for real)

Let’s just do so on eltiempo.

Prepare

useradd --create-home --shell=/bin/bash influxdata-platform
mkdir /var/lib/influxdata-platform
chown influxdata-platform:influxdata-platform /var/lib/influxdata-platform

Run

su - influxdata-platform
tmux new -s influxdata-platform
/opt/influxdata-platform/influxd \
    --http-bind-address "localhost:9999" \
    --bolt-path /var/lib/influxdata-platform/influxd.bolt \
    --engine-path /var/lib/influxdata-platform/engine \
    --nats-path /var/lib/influxdata-platform/nats
1 Like

Setup

export influx=/opt/influxdata-platform/influx

Initial setup

$influx setup
Welcome to InfluxDB 2.0!
Please type your primary username: admin
Please type your password:
Please type your password again:
Please type your primary organization name.: Hiveeyes
Please type your primary bucket name.: default

You have entered:
  Username:          admin
  Organization:      Hiveeyes
  Bucket:            default
  Retention Period:  infinite
Confirm? (y/n): y

UserID          Username    Organization    Bucket  Token
033318157ed68000    admin       Hiveeyes    default <REDACTED>

Remembering this Token is important. Please do so.


From now on, please supply the Token to all other $influx commands:

export influx=/opt/influxdata-platform/influx
export INFLUX_TOKEN=<REDACTED>

User and organization

Create

$influx user create --name hiveeyes
ID          Name
0333c511c4168000    hiveeyes

$influx org create --name Hiveeyes
ID          Name
033318158fd68000    Hiveeyes

Display

$influx user find
ID          Name
033318157ed68000    admin
0333c511c4168000    hiveeyes

$influx org find
ID          Name
033318158fd68000    Hiveeyes

Permissions

Assign superuser permissions to “hiveeyes” user:

echo '{"status":"active","orgID":"033318158fd68000","userID":"0333c511c4168000","description":"superuser token","permissions":[{"action": "read", "resource": "authorizations"}, {"action": "write", "resource": "authorizations"}, {"action": "read", "resource": "buckets"}, {"action": "write", "resource": "buckets"}, {"action": "read", "resource": "dashboards"}, {"action": "write", "resource": "dashboards"}, {"action": "read", "resource": "orgs"}, {"action": "write", "resource": "orgs"}, {"action": "read", "resource": "sources"}, {"action": "write", "resource": "sources"}, {"action": "read", "resource": "tasks"}, {"action": "write", "resource": "tasks"}, {"action": "read", "resource": "telegrafs"}, {"action": "write", "resource": "telegrafs"}, {"action": "read", "resource": "users"}, {"action": "write", "resource": "users"}]}' | \
    http POST http://localhost:9999/api/v2/authorizations \
    "Authorization:Token REDACTED"

Write and query measurements

Get started

export influx=/opt/influxdata-platform/influx
export INFLUX_TOKEN=<REDACTED>

Create bucket

$influx bucket create --org Hiveeyes --name Hotzenplotz
ID          Name        Retention   Organization    OrganizationID
0333b5c520168000    Hotzenplotz 0s      Hiveeyes    033318158fd68000

Write measurement data

This uses line-protocol format. Others like CSV are possible as well.

$influx write 'weather,location=europe temperature=42 1546705458' --precision s --org Hiveeyes --bucket Hotzenplotz

Also, importing a batch of line-protocol items should be possible using

$influx write @/path/to/points.txt --precision s --org Hiveeyes --bucket Hotzenplotz

Query for data

$influx query 'from(bucket: "Hotzenplotz") |> range(start: 1546705458-1)' --org-id 033318158fd68000

Flux requires a time range when querying time series data. “Unbounded” queries are very resource-intensive and as a protective measure, Flux will not query the database without a specified range.

https://docs.influxdata.com/flux/v0.7/introduction/getting-started/query-influxdb/#2-specify-a-time-range


Enjoy!

Mr. Oizo “Flat beat”

Documentation and further resources about Flux

Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It’s part of InfluxDB 1.7 and 2.0, but can be run independently of those.

Articles and more

Integration with Grafana

We will still have to check whether this plays well together with Flux (InfluxDB) [BETA] plugin for Grafana | Grafana Labs.

Update: Looks like this doesn’t fit together out of the box yet. Adding this as a datasource croaks with
image

We know this guy already ;]. The InfluxData Platform has a totally different authentication system compared to what we know from InfluxDB already.