Skip to main content

Command Palette

Search for a command to run...

InfluxDB3 cheatsheet

Updated
2 min read
A

Senior Backend Engineer

InfluxDB 3 client: influxctl

influxctl is the official command-line tool for managing and interacting with InfluxDB 3 clusters. Think of it as your Swiss Army knife for database setup, bucket management, and query execution.

This cheatsheet gives you a quick reference for the most useful commands, so you don’t need to dig into the docs every time.


Installation

brew install influxdata/tap/influxctl   # macOS
apt-get install influxctl               # Debian/Ubuntu (if repo available)

Check version:

influxctl version

Authentication & Config

Set up your connection profile:

influxctl config create --host https://cluster-url --org my-org --token my-super-secret-token --active

List and manage configs:

influxctl config list
influxctl config switch my-org
influxctl config delete old-org

Buckets

Buckets are where data is stored.

Create a bucket:

influxctl bucket create --name my-bucket --retention 30d

List buckets:

influxctl bucket list

Delete a bucket:

influxctl bucket delete --name my-bucket

Users & Orgs

Create a user:

influxctl user create --name arpit --password 'securepass'

List users:

influxctl user list

Manage orgs:

influxctl org list
influxctl org create --name team-analytics

Writing Data

Write line protocol data directly:

echo "weather,location=delhi temperature=32.5" | influxctl write --bucket my-bucket

Write from a file:

influxctl write --bucket my-bucket --file data.lp

Querying Data

Run a SQL query:

influxctl query "SELECT * FROM weather LIMIT 10"

Export results as JSON:

influxctl query "SELECT * FROM weather" --format json

Save to CSV:

influxctl query "SELECT time,temperature FROM weather" --format csv > out.csv

Tokens

List tokens:

influxctl auth list

Create a read-only token:

influxctl auth create --read-bucket my-bucket

Advanced

  • Profiles for multiple clusters
    Easily switch between dev, staging, prod.

      influxctl config create --host https://staging-url --org staging --token token123
      influxctl config switch staging
    
  • Debug connection issues

      influxctl ping
      influxctl health
    
  • Retention policies

      influxctl bucket update --name my-bucket --retention 7d
    

Tips

  • Keep multiple configs for different clusters and switch quickly with influxctl config switch.

  • Use --format json + jq for scriptable queries.

  • Automate backups by exporting queries into CSV on cron.


With this cheatsheet, you should be able to cover most daily tasks in InfluxDB 3 with just influxctl.