Install and use the influx CLI
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
Do one of the following:
Use Homebrew
1. 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:
1. brew list | grep influxdb-cli
Manually download and install
- Download the
influxCLI package from your browser or from the command line.
#### Download from your browser
#### Download from the command line
1. curl -LO https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-darwin-amd64.tar.gz \
2. --output-dir ~/Downloads
2. Unpackage the downloaded binary.
Do one of the following:
- In Finder, double-click the downloaded package file.
-
In your terminal (for example, Terminal or iTerm2) use
tarto extract the package–for example, enter the following command to extract it into~/Downloads:1. tar zxvf ~/Downloads/influxdb2-client-2.7.5-darwin-amd64.tar.gz \ 2. --directory ~/Downloads3. Optional: Place theinfluxbinary in your$PATH–for example, copy the binary to/usr/local/bin:
1. sudo cp ~/Downloads/influx /usr/local/bin/
With the influx binary in your $PATH (/usr/local/bin), you can enter influx in your terminal to run the CLI.
If you do not move the influx binary into your $PATH, enter the path to the binary to run the CLI–for example:
1. ~/Downloads/influx
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 prevents it from running. To authorize the influx binary:
Allow the binary on macOS Ventura
- Follow the preceding instructions to attempt to start
influx. - Open System Settings and click Privacy & Security.
- Under the Security heading, there is a message about “influxd” being blocked, click Allow Anyway.
- When prompted, enter your password to allow the setting.
- Close System Settings.
- Attempt to start
influx. - A prompt appears with the message “macOS cannot verify the developer of “influx”…””. Click Open.
Allow the binary on macOS Catalina
- Attempt to run an
influxcommand. - Open System Preferences and click Security & Privacy.
- Under the General tab, there is a message about
influxbeing blocked. Click Open Anyway. - Download the
influxCLI 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
1. # amd64
2. wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
1. # arm
2. wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-arm64.tar.gz
6. Unpackage the downloaded binary.
Note: The following commands are examples. Adjust the filenames, paths, and utilities if necessary.
1. # amd64
2. tar xvzf ./influxdb2-client-2.7.5-linux-amd64.tar.gz
1. # arm
2. tar xvzf ./influxdb2-client-2.7.5-linux-arm64.tar.gz
7. Optional: Place the unpackaged influx executable in your system $PATH.
1. # amd64
2. sudo cp ./influx /usr/local/bin/
1. # arm
2. sudo cp ./influx /usr/local/bin/
If you do not move the influxd binary into your $PATH, enter the path to the binary to start the server–for example:
1. ./influx
We recommend running influx CLI commands in Powershell. Command Prompt is not fully compatible.
- Download the
influxCLI 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.
1. > Expand-Archive .\influxdb2-client-2.7.5-windows-amd64.zip -DestinationPath 'C:\Program Files\InfluxData\'
2. > 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:
- Select Private networks, such as my home or work network.
- 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 ORG \
4. --token API_TOKEN \
5. --active
Replace the following:
CONFIG_NAME: Connection configuration name.ORG_NAME: your InfluxDB organization.API_TOKEN: your API token.
For more information about managing CLI configurations, see the influx config documentation.
For instructions on how to create API tokens, see Create a token.
Authenticate with a username and password
The influx CLI 2.4.0+ lets you create connection configurations that authenticate with InfluxDB OSS 2.4+ using the username and password combination that you would use to log into the InfluxDB user interface (UI). The CLI retrieves a session cookie and stores it, unencrypted, in your configs path.
Use the --username-password, -p option to provide your username and password using the <username>:<password> syntax. If no password is provided, the CLI prompts for a password after each command that requires authentication.
1. influx config create \
2. -n CONFIG_NAME \
3. -u http://localhost:8086 \
4. -p USERNAME:PASSWORD \
5. -o ORG
Replace the following:
CONFIG_NAME: Connection configuration name.ORG: your organization name.USERNAME:PASSWORD: your UI username and password combination.
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.
