Install and use the influx CLI

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

Use the influx CLI to interact with and manage your InfluxDB instance. Write and query data, generate InfluxDB templates, export data, and more.

The influx CLI is packaged and versioned separately from the InfluxDB server (influxd).

Install the influx CLI

macOS Linux Windows

Do one of the following:

Use Homebrew

  1. brew install influxdb-cli

If you used Homebrew to install InfluxDB v2.3, 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:

  1. brew list | grep influxdb-cli

Manually download and install

  1. Download the influx CLI package.

    influx CLI v2.3.0 (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:

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

    1. # (Optional) Copy the influx binary to your $PATH
    2. sudo cp ~/Downloads/influxdb2-client-2.3.0-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.
  5. 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.3.0 (amd64) influx CLI v2.3.0 (arm)

    Download from the command line

    1. # amd64
    2. wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.3.0-linux-amd64.tar.gz
    3. # arm
    4. wget https://dl.influxdata.com/influxdb/releases/influxdb2-client-2.3.0-linux-arm64.tar.gz
  6. Unpackage the downloaded package.

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

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

    1. # amd64
    2. sudo cp influxdb2-client-2.3.0-linux-amd64/influx /usr/local/bin/
    3. # arm
    4. sudo cp influxdb2-client-2.3.0-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.

  8. Download the influx CLI package.

    influx CLI v2.3.0 (Windows)

  9. Expand the downloaded archive.

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

    1. > Expand-Archive .\influxdb2-client-2.3.0-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\'
    2. > mv 'C:\Program Files\InfluxData\influxdb2-client-2.3.0-windows-amd64' 'C:\Program Files\InfluxData\influx'
  10. 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.

Set up 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.

For instructions on how to create API tokens, see Create a token.

Enable shell completion (Optional)

To install influx shell completion scripts, see influx completion.

Use influx CLI commands

For information about influx CLI commands, see the influx CLI reference documentation.

cli