Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating tables in InfluxDB via Terminal

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?

like image 666
gordon sung Avatar asked Sep 09 '16 19:09

gordon sung


2 Answers

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.

like image 167
Michael Desa Avatar answered Oct 12 '22 02:10

Michael Desa


I just want to quote the moderator of the influxdata community here:

You can think of

  • measurements as tables in SQL,
  • tags as indexed columns,
  • and fields as unindexed columns
like image 37
splash Avatar answered Oct 12 '22 01:10

splash