Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 39 ยท Getting Started

The InfluxDB CLI and UI Tour

Take a guided tour of the influx and influxdb3 command line tools and the 2.x web UI, then write and query your first data points step by step.

You have a running server. Now you need ways to talk to it. InfluxDB offers three: a command-line tool, a web UI (in 2.x) and the HTTP API, which the first two use underneath. This lesson tours the CLI and the UI and walks through the very first write and query, so that the data model in the next chapter has something concrete to attach to.

The commands below need a real server, so they are read-only here. Each section ends with a runnable stand-in that reproduces the idea of the step with JavaScript or SQLite and says so.

The 2.x influx CLI

The influx command talks to an InfluxDB 2.x server. You tell it where the server is and which token to use, either with flags or by saving a config (a named connection profile):

Terminal
influx config create --config-name local \
  --host-url http://localhost:8086 \
  --org my-org --token "$INFLUX_TOKEN" --active

influx bucket list
influx org list
influx auth list

After config create, later commands pick the host, org and token from the active config, so you can type influx bucket list without repeating them. Environment variables work too: INFLUX_HOST, INFLUX_ORG, INFLUX_TOKEN.

The first write and the first query, in 2.x:

Terminal
influx write --bucket my-bucket --precision s \
  'room,name=kitchen temp=21.5,humidity=48 1772359200'

influx query 'from(bucket: "my-bucket") |> range(start: -1h)'

influx write takes line protocol (next chapters explain it). influx query takes a Flux script and prints a table per series.

The 3.x influxdb3 CLI

InfluxDB 3 uses one binary for both server and client. Subcommands cover the common jobs:

Terminal
export INFLUXDB3_AUTH_TOKEN="apiv3_xxx"   # your admin token

influxdb3 create database home
influxdb3 write --database home \
  'room,name=kitchen temp=21.5,humidity=48'
influxdb3 query --database home \
  "SELECT time, name, temp, humidity FROM room ORDER BY time DESC LIMIT 5"
influxdb3 show databases

A database is created explicitly (or implicitly on first write, depending on version and settings). A write that mentions a new measurement creates that table on the fly: you do not declare a schema first. The first point also fixes the data type of each field, a rule you will meet again in line protocol types.

The 2.x web UI

Open http://localhost:8086 and sign in. The left navigation holds the main areas:

Area What you do there
Load Data Create buckets, API tokens, Telegraf configurations, client library snippets
Data Explorer Build a query with clicks, switch to the script editor, view graphs
Dashboards Combine query cells into dashboards
Tasks Schedule Flux scripts (downsampling, alerts)
Alerts Checks, notification endpoints and rules
Settings Variables, templates, labels

The Data Explorer is the best place to experiment. Choose a bucket, pick a measurement, tick a field and the UI writes the Flux for you. The Script Editor button shows that Flux so you can learn from it and tweak it. A query builder is an excellent teacher: build something with clicks, then read the generated code.

For InfluxDB 3 Core, the vendor ships separate tools (an optional Explorer app) rather than a built-in UI, and Cloud offers its own UI. Dashboards are often built in Grafana instead (see the dashboards chapter of this course).

What happens when you write

sequenceDiagram
  participant C as CLI or client
  participant S as InfluxDB server
  participant D as Storage
  C->>S: POST line protocol + token
  S->>S: Authenticate, parse, check types
  S->>D: Append points to storage
  S-->>C: 204 No Content (success)

A successful write returns HTTP 204 with no body; errors return a JSON message.

Stand-in: write then read the first point

This JavaScript mimics the first-write experience: a tiny "server" that accepts a line protocol line, remembers it and returns it by query. It is not InfluxDB and its parser is deliberately simplified (the real format is covered in Line Protocol).

JS A toy write and query (stand-in)

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Stand-in: the same data in SQL

In InfluxDB 3 a measurement is a table with time, tag and field columns. SQLite shows what that looks like and what SELECT ... ORDER BY time DESC LIMIT returns.

SQL Points as a table (SQLite stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Habits worth building from day one

  1. Use named configs or environment variables for tokens instead of pasting them into commands (they end up in shell history).
  2. Use a separate bucket or database for experiments, so that mistakes never touch real data.
  3. Read the error body. A failed write explains which line and which column broke.
  4. Prefer least-privilege tokens: a write-only token for collectors, a read-only token for dashboards.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a successful InfluxDB write return over HTTP?

    A successful write returns 204 with an empty body.
  2. 2. What does influx config create --active do?

    Configs save the connection details so later commands can omit them.
  3. 3. Which part of the 2.x UI would you use to try a query and view a graph?

    Data Explorer has a query builder, a script editor and graph views.
  4. 4. Why avoid typing the token directly in commands?

    Secrets in commands leak through history, process lists and logs; use environment variables or configs.

Summary

  • influx (2.x) and influxdb3 (3.x) are the command-line tools; both wrap the HTTP API.
  • Save connection details in a config or environment variables rather than repeating tokens.
  • The 2.x web UI has Data Explorer, Dashboards, Tasks and Alerts; 3.x leans on other tools such as Grafana.
  • Writing needs no schema: the first points create the measurement or table.
  • A successful write is HTTP 204.

Next: Time-series Data Fundamentals