Documentation

influx - InfluxDB command line interface

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

Do one of the following:

Use Homebrew

brew install influxdb-cli

If you used Homebrew to install InfluxDB 2.7, the influxdb-cli formula was downloaded as a dependency and should already be installed. If installed, influxdb-cli will appear in the output of the following command:

brew list | grep influxdb-cli

Manually download and install

  1. Download the influx CLI package.

    influx CLI v2.7.5 (macOS)

  2. Unpackage the downloaded package.

    Do one of the following:

    • Double-click the downloaded package file in Finder.

    • Run the following command in a macOS command prompt application such Terminal or iTerm2:

      # Unpackage contents to the current working directory
      tar zxvf ~/Downloads/influxdb2-client-2.7.5-darwin-amd64.tar.gz
      
  3. (Optional) Place the binary in your $PATH.

    # (Optional) Copy the influx binary to your $PATH
    sudo cp ~/Downloads/influxdb2-client-2.7.5-darwin-amd64/influx /usr/local/bin/
    

    If you do not move the influx binary into your $PATH, prefix the executable ./ to run it in place.

  4. (macOS Catalina and newer) Authorize the influx binary.

    macOS requires downloaded binaries to be signed by registered Apple developers. When you first attempt to run influx, macOS will prevent it from running. To authorize the influx binary:

    1. Attempt to run an influx command.
    2. Open System Preferences and click Security & Privacy.
    3. Under the General tab, there is a message about influx being blocked. Click Open Anyway.
  1. Download the influx CLI package.

    Download the influx CLI package from your browser or from the command line.

    Download from your browser

    influx CLI v2.7.5 (amd64) influx CLI v2.7.5 (arm)

    Download from the command line

    # amd64
    wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
    
    # arm
    wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-arm64.tar.gz
    
  2. Unpackage the downloaded package.

    Note: The following commands are examples. Adjust the filenames, paths, and utilities if necessary.

    # amd64
    tar xvzf path/to/influxdb2-client-2.7.5-linux-amd64.tar.gz
    
    # arm
    tar xvzf path/to/influxdb2-client-2.7.5-linux-arm64.tar.gz
    
  3. (Optional) Place the unpackaged influx executable in your system $PATH.

    # amd64
    sudo cp influxdb2-client-2.7.5-linux-amd64/influx /usr/local/bin/
    
    # arm
    sudo cp influxdb2-client-2.7.5-linux-arm64/influx /usr/local/bin/
    

    If you do not move the influx binary into your $PATH, prefix the executable ./ to run it in place.

We recommend running influx CLI commands in Powershell. Command Prompt is not fully compatible.

  1. Download the influx CLI package.

    influx CLI v2.7.5 (Windows)

  2. Expand the downloaded archive.

    Expand the downloaded archive into C:\Program Files\InfluxData\ and rename it if desired.

    > Expand-Archive .\influxdb2-client-2.7.5-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\'
    > mv 'C:\Program Files\InfluxData\influxdb2-client-2.7.5-windows-amd64' 'C:\Program Files\InfluxData\influx'
    
  3. Grant network access to the influx CLI.

    When using the influx CLI for the first time, Windows Defender displays the following message:

    Windows Defender Firewall has blocked some features of this app.

    To grant the influx CLI the required access, do the following:

    1. Select Private networks, such as my home or work network.
    2. Click Allow access.

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:

influx config create --config-name <config-name> \
  --host-url https://127.0.0.1:8086 \
  --org <your-org> \
  --token <your-auth-token> \
  --active

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

Credential precedence

There are three ways to provide the necessary credentials to the influx CLI, which uses the following precedence when retrieving credentials:

  1. Command line flags (--host, --org -o, --token -t)
  2. Environment variables (INFLUX_HOST, INFLUX_ORG, INFLUX_TOKEN)
  3. CLI configuration file

Usage

influx [flags]
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)
scriptsScripts management commands (InfluxDB Cloud 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

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).


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB v3 enhancements and InfluxDB Clustered is now generally available

New capabilities, including faster query performance and management tooling advance the InfluxDB v3 product line. InfluxDB Clustered is now generally available.

InfluxDB v3 performance and features

The InfluxDB v3 product line has seen significant enhancements in query performance and has made new management tooling available. These enhancements include an operational dashboard to monitor the health of your InfluxDB cluster, single sign-on (SSO) support in InfluxDB Cloud Dedicated, and new management APIs for tokens and databases.

Learn about the new v3 enhancements


InfluxDB Clustered general availability

InfluxDB Clustered is now generally available and gives you the power of InfluxDB v3 in your self-managed stack.

Talk to us about InfluxDB Clustered