InfluxDB (sequence database), using a common scenario: monitoring statistics. Recording at every millisecond computer memory usage, then according to statistical data, using a graphical interface (InfluxDB V1 GCA Grafana) production line chart memory usage;
It can be understood as a time to record some data (commonly used monitoring data, statistical data point buried), then do Charting statistics;
Currently (2019-09-29) recommended InfluxDB V1 version
1. What is InfluxDB
From the article introduced in the invoicing of its use can probably know the scene, described below from Wikipedia:
InfluxDB is a data timing of InfluxData development of open source type. It is written in Go, focus on high-performance query and stored chronological data. InfluxDB monitoring is widely used in data storage systems, real-time data IoT industry and other scenes.
2, the concept of comparison of common relational database (MySQL) basis
concept | MySQL | InfluxDB |
---|---|---|
Database (the same) | database | database |
Table (different) | table | measurement |
Column (various) | column | Tag (indexed, non-essential), Field (non-indexed), timestemp (unique key) |
-
tag set: different sets of each tag key and the tag value;
-
field set: a set of field key field value and each set;
-
retention policy: data storage strategy (the default policy for autogen) InfluxDB not delete data manipulation, data retention time specified purpose of clearing data;
-
series: a collection of common retention policy, measurement and tag set of;
-
Example data was as follows: where is the census measurement, butterflies and honeybees are field key, location and a tag key scientist
name: census
————————————
time butterflies honeybees location scientist
2015-08-18T00:00:00Z 12 23 1 langstroth 2015-08-18T00:00:00Z 1 30 1 perpetua 2015-08-18T00:06:00Z 11 28 1 langstroth 2015-08-18T00:06:00Z 11 28 2 langstroth
There are three exemplary tag set
3, Notes
- tag can only be of type string
- Unlimited field type
- Does not support join
- Support continuous query (summary statistics): CONTINUOUS QUERY
- With Telegraf service (Telegraf system can monitor CPU, memory, network and other data)
- With Grafana service (data presentation graphical interface, the data visualization influxdb)
4, commonly used InfluxQL
-- 查看所有的数据库
show databases;
-- 使用特定的数据库 use database_name; -- 查看所有的measurement show measurements; -- 查询10条数据 select * from measurement_name limit 10; -- 数据中的时间字段默认显示的是一个纳秒时间戳,改成可读格式 precision rfc3339; -- 之后再查询,时间就是rfc3339标准格式 -- 或可以在连接数据库的时候,直接带该参数 influx -precision rfc3339 -- 查看一个measurement中所有的tag key show tag keys -- 查看一个measurement中所有的field key show field keys -- 查看一个measurement中所有的保存策略(可以有多个,一个标识为default) show retention policies;
5、InfluxDB Java Demo
Author: Muscleape
link: https: //www.jianshu.com/p/68c471bf5533
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.