InfluxDB 1.x

From Leo's Notes
Revision as of 19:38, 11 May 2020 by Leo (talk | contribs)
This page was last edited on 11 May 2020, at 19:38.

InfluxDB is a time series database written in Go.

Writing Data

The schema of a InfluxDB database is based on the very first initial data types added. Adding additional data with a different type will be rejected.

Curl

Using curl, you can POST values to a particular database using the line protocol. For more information, see https://docs.influxdata.com/influxdb/v0.9/write_protocols/line/

$ curl -X POST 'http://influxdb/write?db=lsf' --data-binary 'measurement,tag1=x,tag2=x recorded_value1=x `date +%s"000000000"`'

For multiple entries, write multiple lines separated by a \n newline and POST with Curl like above.

$ cat /tmp/measurements | curl -X POST 'http://influxdb/write?db=lsf' --data-binary @-'

Deleting Measurement

To delete an entire measurement, you must enter the influx command line, set the database and then run DROP MEASUREMENT. You cannot do this from Chronograf.

# influx -host localhost
Connected to http://localhost:8086 version 1.7.10
InfluxDB shell version: 1.7.10
> show databases;
nodered
> use nodered
Using database nodered
> drop measurement local_weather;
>

Migrating from Prometheus

A proprietary tool might exist. See: https://docs.tibco.com/pub/ftl/5.4.0/doc/html/GUID-BAE2C630-90B2-47FC-A7D6-97AB16065A0C.html

To migrate data from Prometheus to InfluxDB, use the prom2influx migration utility

Ensure that the Prometheus server is running.

Ensure that the InfluxDB server is running.

Run the migration utility. For example, this command migrates all the data points in Prometheus:

prom2influx -prometheus http://prom_host:9090 -influx http://influx_host:8086

The duration of this step depends on the amount of data you migrate, network communication bandwidth and speeds, and other factors. You can migrate a subset of the data by specifying the -start and -range parameters, for example:

prom2influx -prometheus http://prom_host:9090 -influx http://influx_host:8086 -start 2018-03-12T12:00:57-05:00 -range 1y