当前位置:网站首页>InfluxDB时序数据库
InfluxDB时序数据库
2022-06-25 07:02:00 【victorwjw】
InfluxDB是一个由InfluxData开发的开源时序型数据。它由Go写成,着力于高性能地查询与存储时序型数据。InfluxDB被广泛应用于存储系统的监控数据,IoT行业的实时数据等场景。
InfluxDB有三大特性:
- Time Series (时间序列):你可以使用与时间有关的相关函数(如最大,最小,求和等)
- Metrics(度量):你可以实时对大量数据进行计算
- Eevents(事件):它支持任意的事件数据
InfluxDB详解_顺其自然~的博客-CSDN博客_influxdb
database:数据库;
measurement:数据库中的表;
points:表里面的一行数据。
influxDB中独有的一些概念:Point由时间戳(time)、数据(field)和标签(tags)组成。series:一些数据结合,同一个database下,retention policy、measurement、tag sets完全相同的数据同属于一个 series,同一个series的数据物理上会存放在一起;
在influxdb中,字段必须存在。因为字段是没有索引的。如果使用字段作为查询条件,会扫描符合查询条件的所有字段值,性能不及tag。类比一下,fields相当于SQL的没有索引的列。
tags是可选的,但是强烈建议你用上它,因为tag是有索引的,tags相当于SQL中的有索引的列。tag value只能是string类型。
常用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;
create database db1 -- 创建数据库db1
drop database db1 -- 删除数据库db1
drop measurement mt1 -- 删除表mt1
delete from measurement [WHERE <tag_key> <operator>]
drop shard <shard_id_num> 删除分片influxdbV1 和influxdbV2
1. 查询方法变更
原来使用InfluxQL方式查询,现在使用内置的Flux方式查询
2. 底层数据结构变更
原来的bucket+时间保留计划=现在的bucket
3. task取代连续查询
1.x版本和2.x版本最大的差异是连续查询(continuous query)已经被任务(task)所取代。influxdb中的连续查询功能是对外提供的对数据处理的功能,如为了预防我们的存储日志过大会建立起保存策略,超过设置的超时时间数据就丢失了。针对这种情况,我们可以通过连续查询功能,对用户的数据进行汇总、抽样等操作,再插入到另外的表中即可,虽然丢失了一定的精度,但是让数据占用的空间大大减小。
安装与访问

2.x版本,需要记住 bucket host org token
时序数据库influxDB(一)Linux安装与图形化/CLI连接influxDB2.2.0_xuehu96的博客-CSDN博客_influxdb连接
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边栏推荐
- 钱堂教育商学院给的证券账户安全吗?能开户吗?
- 2022年毕业生求职找工作青睐哪个行业?
- TCP 加速小记
- How to calculate the correlation coefficient and correlation degree in grey correlation analysis?
- 每日刷题记录 (三)
- leetcode.13 --- 罗马数字转整数
- 以科技赋能设计之美,vivo携手知名美院打造“产学研”计划
- Remove headers from some pages in a word document
- C examples of using colordialog to change text color and fontdialog to change text font
- [QT] qtcreator shortcut key and QML introduction
猜你喜欢

C disk drives, folders and file operations

面试前准备好这些,Offer拿到手软,将军不打无准备的仗

How to calculate the information entropy and utility value of entropy method?

Establish open data set standards and enable AI engineering implementation

堆栈认知——栈溢出实例(ret2libc)

Bluecmsv1.6- code audit

How to interpret the information weight index?

How to analyze the coupling coordination index?

以科技赋能设计之美,vivo携手知名美院打造“产学研”计划

TS environment setup
随机推荐
Biweekly investment and financial report: capital ambush Web3 infrastructure
RMQ interval maximum subscript query, interval maximum
PHP array function Encyclopedia
TCP MIN_ A dialectical study of RTO
How to calculate the fuzzy comprehensive evaluation index? How to calculate the four fuzzy operators?
Remove headers from some pages in a word document
Rosparam statement
Want to open an account, is it safe to open an online stock account?
六月集训(第25天) —— 树状数组
物联网毕设(智能灌溉系统 -- Android端)
Rank sum ratio (RSR) index calculation
Drawing of clock dial
Is there any risk in the security of new bonds
2022年毕业生求职找工作青睐哪个行业?
想转行学软件测试担心哪些问题?
打新债的安全性 有风险吗
软件确认测试有什么作用?确认测试报告的价格是多少?
4 reasons for adopting "safe left shift"
DNS protocol and its complete DNS query process
TCP 加速小记