Commands Cheat Sheet

Evaluating engineering tools? Get the comparison in Google Sheets

(Perfect for making buy/build decisions or internal reviews.)

Most-used commands
Your email is safe thing.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

Connection

influx
Command line client for InfluxDB

influx -host -port -username -password
Connect to a specific InfluxDB instance

influx -ssl -unsafeSsl
Connect using SSL without certificate verification

influx -precision rfc3339
Connect with timestamp precision set to RFC3339

Database Management

SHOW DATABASES
List all databases

CREATE DATABASE
Create a new database

DROP DATABASE
Delete a database

USE
Switch to a specific database

Data Querying

SHOW MEASUREMENTS
List all measurements (similar to tables)

SHOW SERIES
List all series in the database

SHOW TAG KEYS FROM
List all tag keys for a measurement

SHOW FIELD KEYS FROM
List all field keys for a measurement

SELECT * FROM LIMIT 10
Query the most recent 10 rows from a measurement

SELECT * FROM WHERE time > now() - 1h
Query data from the last hour

SELECT MEAN(field) FROM WHERE time > now() - 1d GROUP BY time(1h)
Calculate hourly averages for the last day

Data Writing

INSERT ,= =
Write a data point

INSERT cpu,host=server01 usage_idle=90.1,usage_user=9.9
Example of writing multiple fields

curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu,host=server01 usage_idle=90.1'
Write data using HTTP API

Retention Policies

SHOW RETENTION POLICIES ON
List retention policies

CREATE RETENTION POLICY ON DURATION REPLICATION [DEFAULT]
Create retention policy

ALTER RETENTION POLICY ON DURATION
Modify retention policy

DROP RETENTION POLICY ON
Delete retention policy

User Management

SHOW USERS
List all users

CREATE USER WITH PASSWORD ''
Create a new user

CREATE USER WITH PASSWORD '' WITH ALL PRIVILEGES
Create admin user

GRANT [READ,WRITE,ALL] ON TO
Grant permissions

REVOKE [READ,WRITE,ALL] ON FROM
Revoke permissions

DROP USER
Delete user

Continuous Queries

SHOW CONTINUOUS QUERIES
List continuous queries

CREATE CONTINUOUS QUERY ON BEGIN SELECT INTO FROM GROUP BY time() END
Create continuous query

DROP CONTINUOUS QUERY ON
Delete continuous query

Debugging

SHOW STATS
Show InfluxDB statistics

SHOW DIAGNOSTICS
Show diagnostic information

influxd version
Show InfluxDB version