The Moving Parts
InfluxDB presents as one program, and the surprises in this guide — every one of them — are a part doing its own job while the reader watched another part. This chapter names the parts before the surprises arrive.
The server: influxd
One binary is the whole database. It
listens on one HTTP port (8086 by
default; the lab used a loopback port of
its own), serves the web interface from
that same port, keeps its metadata in a
Bolt key-value file (influxd.bolt)
and the measurements themselves in an
engine folder of time-partitioned
files. Two environment variables move
the furniture: INFLUXD_BOLT_PATH and
INFLUXD_ENGINE_PATH. The lab pointed
both into its scratch folder, which is
why its whole database — metadata, two
buckets of weather, tasks and all —
could be measured at the end: 608 KB.
Organisations, users and buckets
Three containers nest inside the server:
- An organisation is the tenancy:
everything belongs to exactly one. The
lab's is
example-org. - A user is a person (or a fiction standing in for one) who signs in to the web interface with a password.
- A bucket is where points live —
the v2 word for what other databases
call a database or a table-space.
Every bucket carries a retention
rule: how long its points stay. The
setup creates your first bucket plus
two of its own:
_monitoring(keeps 168 hours) and_tasks(72 hours), which hold the server's diary of itself.
Points: measurements, tags, fields
A point is one line of line protocol, and its anatomy is the whole data model:
weather,station=rooftop-1 temperature=18.1,humidity=57i 1793499960
└──┬──┘ └──────┬───────┘ └────────────┬──────────────┘ └────┬────┘
measurement tags fields timestamp
- The measurement is the name of
the stream:
weather. - Tags are labels —
stationhere. Tag values are always words, they are indexed, and they are how you slice: rooftop versus garden. A tag set plus a measurement names a series. - Fields are the values themselves,
typed:
temperaturea decimal,humidityan integer (theisuffix says so). Fields are not indexed; they are what you measure, average and graph. - The timestamp is the point's identity. Same series, same field, same moment, new value: the new value replaces the old. That is the only edit InfluxDB knows, and chapter 11 uses it to correct a reading.
The tag/field split is the one design decision to make carefully: tags are for the kinds of thing you count (stations, rooms, hosts), fields for the numbers you measure. Chapter 13 explains the cardinality cliff that waits if a unique-per-reading value — a request ID, a full URL — is made a tag.
The CLI: influx
The second binary is the remote control.
It talks to the server over the same
HTTP API everything else uses, guided by
a config: a named bundle of server
address, organisation and token, kept in
a small file (~/.influxdbv2/configs by
default). influx setup, write,
query, bucket, auth, task,
backup — every verb in this guide is
the CLI asking the API politely. Which
means anything the CLI can do, curl can
do, and chapter 8 does it with curl so
you can watch the wires.
Flux, the question language
Queries are written in Flux: a pipe
of tables through functions. from
names the bucket, range the slice of
time (nearly every query has one),
filter picks rows, aggregateWindow
folds time into averages, mean and
max summarise. Results come back as
annotated CSV — tables whose columns
include _time, _value, _field and
_measurement — one table per series.
Chapter 5 is the tour.
Tasks: Flux on a schedule
A task is a saved Flux script with
a timetable (every: 1m, or a cron
expression) that the server itself runs.
Tasks are how raw points become standing
summaries: chapter 9's task reads the
weather bucket every minute and writes
ten-minute means into a second bucket,
forever, with nobody at the keyboard.
Which part holds what
| Question | The part that answers it |
|---|---|
| Why was my old point refused? | The bucket's retention rule (chapter 6) |
| Why can I read but not write? | The token's permissions (chapter 7) |
| Why did the CLI hang on write? | The CLI, listening to stdin (chapter 4) |
| Why does this bucket "not exist" for my token? | The token again — it cannot see it (chapter 7) |
| Why is the last window's time odd? | Flux windows, labelled by their end (chapter 5) |
| Why did the restore stop halfway? | The token changed under it mid-restore (chapter 10) |
Keep this table in mind. In InfluxDB, the answer is very often the token or the bucket — and now you know which chapter holds each.