I am a beginner with InfluxDB and I've read the intro documentation, but cannot find any details on how to create a new measurement. Am I missing something ?
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.
create database <data base name of your choice>
create user "<username>" with password '<password>'
To see the all databases: SHOW DATABASES
Enter the Database: use <database name>
To see all tables inside the database: SHOW MEASUREMENTS
grant all on <data base name> to <username>
insert data (Here Motionsense is a Measurement which is similar to the table name of SQL): INSERT MotionSense,SensorType=Gyro roll=1.2,yaw=5,pitch=3
See the data of the Measurements: SELECT * FROM "MotionSense"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With