Influxdata is a platform for storing, collecting, visualizing and managing time-series data. It is faster than mysql. In influxdb time is the primary key. So lets start.
After installing start its service
The service will be started.
Now open another terminal and start the CLI using command
$ influx Connected to http://localhost:8086 version 0.13.x InfluxDB shell 0.13.x >
First create a database
> create database mydb
To view the list of databases
> show databases name: databases --------------- name _internal mydb >
For using the database
> use mydb
Note : In influxdb we call tables as measurements and columns as fields.
We don’t need to define measurements(tables) and fields(columns). It will create measurements and add columns automatically when we insert data.
Format for writing data is
measurementName field1=value1,field2=value2,field3=value3 timestamp
- The timestamp is in nanoseconds. If we don’t provide timestamp it will assign the local current timestamp.
- By default it assumes all the numbers as doubles. For integer value we have to append
iat the end.
> insert measurementName field4=12i
- String values should be in double quotes.
> insert measurementName field5="qwqw"
- For boolean values use t, T, true, True, or TRUE for TRUE, and f, F, false, False, or FALSE for FALSE
> insert measurementName field6=T
- We can use
\character for escaping comma, space, equal and other special character in field (field) value
For more details refer official documentation
To select all fields from measurement
> select * from measurementName
To select particular fields
> select field1, field2 from measurement
Note : If your mesurement name or field name contains characters such as
=, then use double quotes
> select "field1.name", "field2.name" from "measurement.name"
A typical usage of where clause
> select * from measurement where field1 > 12 and field2 = 'sparta' and time > now() - 1d
We can also use
or logic using separaters
Supported comaparaters in influxdb are
<>not equal to
!=not equal to
!~doesn’t match against
You can read about queries in details from its website