InfluxDB Handbook


Enable auth-only access by creating admin user:

$ curl --silent --get '' --user root:root --data-urlencode 'q=CREATE USER admin WITH PASSWORD 'admin' WITH ALL PRIVILEGES'

Database operations

Create database:

curl --silent --get '' --user admin:admin --data-urlencode 'q=CREATE DATABASE "hiveeyes_100"'

List databases:

curl --silent --get '' --user admin:admin --data-urlencode 'q=SHOW DATABASES' | jq '.'

Drop database:

curl --silent --get '' --user admin:admin --data-urlencode 'q=DROP DATABASE "hiveeyes_100"'

Query operations

Inquire IP address from boot2docker host:

boot2docker ip

Query database using curl:

# pretty-print json using jq
curl --silent --get '' --user admin:admin --data-urlencode 'db=hiveeyes_100' --data-urlencode 'q=select * from "1.99";' | jq '.'

Querying from Python

from influxdb.client import InfluxDBClient
client = InfluxDBClient('', 8086, 'root', 'root', 'kotori')
client.query('select * from telemetry;')

Backup and Restore

Backup example:

influxd backup -database hiveeyes_25a0e5df_9517_405b_ab14_cb5b514ac9e8 -host hiveeyes_25a0e5df_9517_405b_ab14_cb5b514ac9e8

Restore example:

influxd restore -datadir /var/lib/influxdb/data -database hiveeyes_25a0e5df_9517_405b_ab14_cb5b514ac9e8 hiveeyes_25a0e5df_9517_405b_ab14_cb5b514ac9e8

Export and Import

CSV-based import and export using


http GET from=2016-01-01 --download


export GOPATH=`pwd`
go get -v

./bin/csv-to-influxdb --batch-size=1 --timestamp-column=time --timestamp-format="2006-01-02 15:04:05.000000000" --server=http://localhost:8086 --database=hiveeyes_25a0e5df_9517_405b_ab14_cb5b514ac9e8 --measurement=3756782252718325761_1 ../../data/25a0e5df_9517_405b_ab14_cb5b514ac9e8_3756782252718325761_1_20160101T000000_20160705T195237.csv
2016/07/05 21:55:15 Done (wrote 34304 points)