InfluxDB is an open source distributed timing, event, and metrics database.
Written in the Go language without external dependencies. Its design goal is to achieve distributed and horizontal scaling expansion.
It has three main features:
1. Time series (timeseries): You can use time-related functions (such as Max, Min, sum, etc.)
2. Metrics (Metric): You can calculate large amounts of data in real time
3. Eevents (Event): It supports arbitrary event data
Characteristics
Schemaless (unstructured), can be any number of columns
Scalable
Min, max, sum, count, mean, median a series of functions for convenient statistics
Native http API, built-in HTTP support, read and write using HTTP
Powerful Query Language similar to SQL
Built-in Explorer comes with management tools
After installing INFLUXDB, log in to the database via terminal, HTTP API over 8086, page 8083
[[email protected] ~]# inf
Influx Influx_inspect INFLUX_TSM infocmp infotocap
Influxd influx_stress Info Infokey
Via Influx Landing terminal
[Email protected] ~]# influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB Server management, and monitoring.
Connected to http://localhost:8086 version 0.13.0
InfluxDB Shell version:0.13.0
1, Creating a database, pay attention to the case of keywords
> CREATE DATABASE mydb;
> SHOW DATABASES;
Name:databases
---------------
Name
Telegraf
_internal
Mytab
MyDB
2, switch the library, some of the key words are not so standardized
> Use MyDB
Using Database MyDB
> Use MyDB
Using Database MyDB
3. Writing and exploring data, writing a single piece of information requires a basic format
1, a short primer on the datastore# the entity object that holds the data, rather the table name of the relational data
The data in the timing database (InfluxDB) is an organized time series that contains a measured value (that is, the field in Rmdb), in InfluxDB such as cpu_load or temperature,
Points is written to InfluxDB using the line Protocol, which follows the following format:
<measurement>[,<tag-key>=<tag-value>, ...] <field-key>=<field-value>[,< Field2-key>=<field2-value>, ...] [Unix-nano-timestamp]
The following lines is all examples of points so can be written to InfluxDB:
Cpu,host=servera,region=us_west value=0.64
Payment,device=mobile,product=notepad,method=credit billed=33,licenses=3i 1434067467100293230
STOCK,SYMBOL=AAPL bid=127.46,ask=127.48
temperature,machine=unit42,type=assembly external=25,internal=37 1434067467000000000
These 3 examples are written in a specific way:
There are no explicit statements for new tables in Influxdb, only new tables can be created by insert data. As shown below:
Insert Disk_free,hostname=server01 value=442221834240i 1435362189575692182
Where Disk_free is the table name, hostname is the index, VALUE=XX is the record value, the record value can have multiple, and finally the time specified
> Insert Cpu,host=servera,region=us_west value=0.64
> select Host,region, value from CPU # #官方写法是把这些测量值加引号
Name:cpu
---------
TimehostregionValue
1481203149917071248serverAus_west0.64
Insert Disk_free,hostname=server01 value=442221834240i 1435362189575692182
In this statement, Disk_free is the table name, Hostname=server01 is the tag, belongs to the index, VALUE=XX is the field, this can be arbitrarily written, arbitrarily defined.
A point with the measurement name of the CPU and tags host and region have now been written to the database, with the measured Value of 0.64.
Another type of data store, in the same measure two fields:
The same measurement value contains data for two field types
INSERT temperature,machine=unit42,type=assembly external=25,internal=37
> select * FROM temperature
Name:temperature
-----------------
Timeexternalinternalmachinetype
1481203797530630901unit42Assembly
Delete a measure
Delete from CPU
Method supported by Show
Continuous, DATABASES, diagnostics, FIELD, GRANTS, measurements, QUERIES,
RETENTION, SERIES, SHARD, Shards, STATS, subscriptions, TAG, USERS
Show tag KEYS from "Temperature" displays the label of the measure ===show create TABLE AA
INFLUXDB Support Regular
Series Operations
The series represents the data in this table, which can be drawn as a few lines on the chart, and series is calculated mainly by the tags permutation combination.
Show series from Mem
This article is from the "DBSpace" blog, so be sure to keep this source http://dbspace.blog.51cto.com/6873717/1880952
The basic operation of INFLUXDB learning Influxdb