influx - InfluxDB command line interface

This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.

The influx command line interface (CLI) includes commands to manage many aspects of InfluxDB, including buckets, organizations, users, tasks, etc.

InfluxDB OSS and influx CLI versions

Beginning with InfluxDB 2.1, the influx CLI is packaged and versioned separately from InfluxDB. InfluxDB and influx CLI versions may differ, but compatibility is noted for each command.

Download and install the influx CLI

Download and install the influx CLI

Provide required authentication credentials

To avoid having to pass your InfluxDB host, API token, and organization with each command, store them in an influx CLI configuration (config). influx commands that require these credentials automatically retrieve these credentials from the active config.

Use the influx config create command to create an influx CLI config and set it as active:

  1. influx config create --config-name <config-name> \
  2. --host-url http://localhost:8086 \
  3. --org <your-org> \
  4. --token <your-auth-token> \
  5. --active

For more information about managing CLI configurations, see the influx config documentation.

Usage

  1. influx [flags]
  2. influx [command]

Commands

CommandDescription
applyApply an InfluxDB template
authAPI token management commands
backupBack up data (InfluxDB OSS only)
bucketBucket management commands
bucket-schemaManage InfluxDB bucket schemas (InfluxDB Cloud only)
completionGenerate completion scripts
configConfiguration management commands
dashboardsList dashboards
deleteDelete points from InfluxDB
exportExport resources as a template
helpHelp about any command
orgOrganization management commands
pingCheck the InfluxDB /health endpoint
queryExecute a Flux query
restoreRestore backup data (InfluxDB OSS only)
secretManage secrets
setupCreate default username, password, org, bucket, etc. (InfluxDB OSS only)
stacksManage InfluxDB stacks
taskTask management commands
telegrafsTelegraf configuration management commands
templateSummarize and validate an InfluxDB template
userUser management commands
v1Work with the v1 compatibility API
versionPrint the influx CLI version
writeWrite points to InfluxDB

Flags

FlagDescription
-h—helpHelp for the influx command

Flag patterns and conventions

The influx CLI uses the following patterns and conventions:

Mapped environment variables

influx CLI flags mapped to environment variables are listed in the Mapped to column of the Flags table in each command documentation. Mapped flags inherit the value of the environment variable. To override environment variables, set the flag explicitly in your command.

View mapped environment variables

Some influx CLI commands may not support all mapped environment variables. For more information about what mapped environment variables each command supports, see the command documentation.

Environment variableDescription
INFLUX_ACTIVE_CONFIGCLI configuration to use for commands
INFLUX_BUCKET_IDBucket ID
INFLUX_BUCKET_NAMEBucket name
INFLUX_CONFIGS_PATHPath to influx CLI configurations (default ~/.influxdbv2/configs)
INFLUX_HIDE_HEADERSHide table headers in command output (default false)
INFLUX_HOSTHTTP address of InfluxDB (default http://localhost:8086)
INFLUX_NAMEInfluxDB Username
INFLUX_ORGInfluxDB Organization name
INFLUX_ORG_DESCRIPTIONOrganization description
INFLUX_ORG_IDInfluxDB Organization ID
INFLUX_OUTPUT_JSONReturn command output JSON
INFLUX_SKIP_VERIFYSkip TLS certificate verification
INFLUX_TOKENInfluxDB API token

Shorthand and longhand flags

Many influx CLI flags support both shorthand and longhand forms.

  • shorthand: a shorthand flag begins with a single hyphen followed by a single letter (for example: -c).
  • longhand: a longhand flag starts with two hyphens followed by a multi-letter, hyphen-spaced flag name (for example: --active-config).

Commands can use both shorthand and longhand flags in a single execution.

Flag input types

influx CLI flag input types are listed in each the table of flags for each command. Flags support the following input types:

string

Text string, but the flag can be used only once per command execution.

stringArray

Single text string, but the flag can be used multiple times per command execution.

integer

Sequence of digits representing an integer value.

duration

Length of time represented by an integer and a duration unit (1ns, 1us, 1µs, 1ms, 1s, 1m, 1h, 1d, 1w).

cli