How to create a measurement in InfluxDB

As noted in the comments, to "create" a new measurement you simply insert data into that measurement.

For example

$ influx
> CREATE DATABASE mydb
> USE mydb
Using database mydb
> SHOW MEASUREMENTS
> INSERT cpu,host=serverA value=10
> SHOW MEASUREMENTS
name: measurements
name
----
cpu

> INSERT mem,host=serverA value=10
> SHOW MEASUREMENTS
name: measurements
name
----
cpu
mem

In INFLUX DB , you cant create empty measurements. You need to add some data as well.

For Example,

INSERT xyz,name=serverA value=10,count=10

This will create a measurement name xyz where
tag keys : name
field keys : value & count

You can check Field and tag keys by executing show field keys or show tag keys.

In the INSERT command, the format is like :
measurement_name,tag keys + value separated by comma Field keys with value separated by comma

eg: INSERT xyz,name=serverA value=10,count=10

In this way, you can create measurement with specifying your required field and tag keys.


You cannot create an empty measurement, afaik. Like they said above, if you want one you need to start writing to it and that should take care of creating one along with some data in it.

insert load,app_name=app3,groupname=second,performance=degraded uuid=003,loading=50,frequency=1

In the above, we are using "insert" to write new data into a new measurement called "load". app_name,groupname,performance are 'tags' and uuid,loading,frequency are fields

Tags:

Influxdb