Creating tables in InfluxDB via Terminal

gordon sung picture gordon sung · Sep 9, 2016 · Viewed 9.9k times · Source

Are there tutorials online that teaches you how to create tables and input values in InfluxDB? How would you create a table and insert values into them?

Answer

Michael Desa picture Michael Desa · Sep 12, 2016

InfluxDB doesn't really have the concept of a table. Data is structured into series, which is composed of measurements, tags, and fields.

Measurements are like buckets.

Tags are indexed values.

Fields are the actual data.

Data is written into InfluxDB via line protocol. The structure of line protocol is as follows

<measurement>,<tag>[,<tags>] <field>[,<field>] <timestamp>

An example of a point in line protocol:

weather,location=us-midwest temperature=82 1465839830100400200

To insert data into the database you'll need to issue an HTTP POST request to the /write endpoint, specifying the db query parameter.

For example:

curl -XPOST http://localhost:8086/write?db=mydb --data-binary "weather,location=us-midwest temperature=82 1465839830100400200"

For more information see the Getting Started section of the InfluxDB docs.