Query language and API
In this section, we will discuss InfluxDB query language and how to use InfluxDB API.
Query language
InfluxDB provides an SQL-like query language; it is used for querying time-series data. It also supports HTTP APIs for write and performs admin-related work.
Let's use the InfluxDB CLI tool to connect to an InfluxDB instance and run some queries.
Start and connect to the InfluxDB instance by typing the following commands:
sudo service InfluxDB start $ influx -precision rfc3339
By default, InfluxDB shows the time as nanosecond UTC value, it is a very long number, like 1511815800000000000
. The argument -precision rfc3339
is for the display time field as a human readable format - YYYY-MM-DDTHH:MM:SS.nnnnnnnnnZ
:
Connected to http://localhost:8086 version 1.5 InfluxDB shell version: 1.5 >
We can check available databases by using the show databases
function:
> show databases; name: databases name ---- _internal
To use the command to switch to an existing database, you can type...