当前位置:网站首页>Incluxdb time series database

Incluxdb time series database

2022-06-25 08:27:00 victorwjw

InfluxDB It's a by InfluxData Development of open source sequential data . It consists of Go It's written in , Focus on high-performance query and storage of sequential data .InfluxDB It is widely used in monitoring data of storage system ,IoT Real time data and other scenarios of the industry .

InfluxDB There are three characteristics :

  1. Time Series ( The time series ): You can use time - dependent correlation functions ( Like the biggest , Minimum , Make a peace, etc )
  2. Metrics( Measure ): You can calculate a lot of data in real time
  3. Eevents( event ): It supports arbitrary event data

InfluxDB Detailed explanation _ Let nature take its course ~ The blog of -CSDN Blog _influxdb

database: database ;
measurement: Tables in the database ;
points: A row of data in the table .
influxDB Some unique concepts in :Point By time stamp (time)、 data (field) And labels (tags) form .series: Some data combination , The same database Next ,retention policy、measurement、tag sets Identical data belong to the same series, The same series The data will be physically stored together ;

stay influxdb in , Field must exist . Because the field has no index . If you use fields as query criteria , Will scan all field values that match the query criteria , The performance is not as good as tag. Analogy ,fields amount to SQL No indexed columns for .
tags It's optional , But it is strongly recommended that you use it , because tag It's indexed ,tags amount to SQL Indexed columns in .tag value Can only be string type .
 

 Commonly used InfluxQL


--  View all databases 
show databases;
--  Using a specific database 
use database_name;
--  View all measurement
show measurements;
--  Inquire about 10 Data 
select * from measurement_name limit 10;
--  The time field in the data displays a nanosecond timestamp by default , Change to readable format 
precision rfc3339; --  We'll check later , Time is rfc3339 A standard format 
--  Or when connecting to a database , Directly with this parameter 
influx -precision rfc3339
--  View one measurement All of the tag key 
show tag keys
--  View one measurement All of the field key 
show field keys
--  View one measurement All of the save strategies in ( There can be multiple , One sign is default)
show retention policies;


create database db1  --  Create database db1
drop database db1  --  Delete database db1
drop measurement mt1  --  Delete table mt1
delete from measurement [WHERE <tag_key> <operator>]
drop shard <shard_id_num>  Delete fragment 





function · InfluxDB Chinese document      

influxdbV1 and influxdbV2
1. Query method changes
The original use InfluxQL Mode query , Now use the built-in Flux Mode query

2. The underlying data structure changes
The original bucket+ Time retention schedule = current bucket

3. task Replace continuous queries
1.x Version and 2.x The biggest difference between versions is continuous query (continuous query) Has been tasked with (task) replaced .influxdb The continuous query function in is a data processing function provided externally , For example, in order to prevent our storage logs from being too large, we have established a storage policy , Data will be lost after the set timeout . In this case , We can use the continuous query function , Summarize the user's data 、 Sampling and other operations , Insert it into another table , Although some precision is lost , But the space occupied by data is greatly reduced .
 

Installation and access

2.x edition , Need to remember  bucket host org  token

Time series database influxDB( One )Linux Installation and graphics /CLI Connect influxDB2.2.0_xuehu96 The blog of -CSDN Blog _influxdb Connect

Flux query basics | Flux 0.x Documentation

from(bucket: "example-bucket")              // ── Source
    |> range(start: -1d)                    // ── Filter on time
    |> filter(fn: (r) => r._field == "foo") // ── Filter on column values
    |> group(columns: ["sensorID"])         // ── Shape
    |> mean()                               // ── Process

原网站

版权声明
本文为[victorwjw]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206250702186262.html