LinuxCommandLibrary

influx

Interact with InfluxDB from the command line

TLDR

Connect to an InfluxDB running on localhost with no credentials

$ influx
copy

Connect with a specific username (will prompt for a password)
$ influx -username [username] -password ""
copy

Connect to a specific host
$ influx -host [hostname]
copy

Use a specific database
$ influx -database [database_name]
copy

Execute a given command
$ influx -execute "[influxql_command]"
copy

Return output in a specific format
$ influx -execute "[influxql_command]" -format [json|csv|column]
copy

SYNOPSIS

influx [global-flags] <subcommand> [<arguments>]

PARAMETERS

--config, -c string
    Path to InfluxDB config file (default "~/.influxdbv2/configs")

--context, -x string
    Config context name (default "default")

-h, --help
    Show help for command

--host string
    InfluxDB HTTP API host (default "http://localhost:8086")

--http-timeout duration
    Request timeout (default 30s)

--http-no-verify
    Disable TLS certificate verification

--org string
    Organization name

--org-id string
    Organization ID

--token string
    API authentication token

--user-ui
    Open InfluxDB UI in browser

DESCRIPTION

The influx command is the official command-line interface for InfluxDB, an open-source time series database optimized for high-speed storage and retrieval of timestamped data. It enables users to manage InfluxDB resources, execute queries, write data, and automate administrative tasks across InfluxDB Cloud, OSS, and Enterprise editions.

Key functionalities include initial setup with influx setup, organization and bucket management, user and token handling, Flux query execution for data analysis, and line protocol data ingestion. Global flags configure API connections, such as host, authentication tokens, and organization details. Contexts allow switching between multiple InfluxDB instances seamlessly.

Ideal for DevOps, monitoring, IoT, and analytics workflows, influx supports scripting in Bash, Python, and CI/CD pipelines. It communicates via HTTP/HTTPS to the InfluxDB API, requiring a running instance. For InfluxDB 1.x, a legacy version exists with query shell capabilities, but v2 CLI is recommended for modern usage.

CAVEATS

Requires running InfluxDB 2.x instance and operator token for most operations; v1.x syntax differs significantly. Uses HTTP API, so network/firewall access needed.

MAJOR SUBCOMMANDS

setup: Initial org/bucket/user config.
query: Run Flux queries.
bucket: Manage time series buckets.
token: Create/list auth tokens.

EXAMPLE USAGE

influx setup --org myorg --bucket data --username admin --password pass --token abc123
influx query 'from(bucket:"data") |> range(start: -1h)' --org myorg

HISTORY

Developed by InfluxData; legacy v1 CLI from 2013 focused on query shell. Rewritten for InfluxDB 2.0 (April 2021) with Flux support and resource management.

SEE ALSO

influxd(8), telegraf(1), flux(1)

Copied to clipboard