时序数据库InfluxDB

来源:互联网 发布:如何看待网络成瘾行为 编辑:程序博客网 时间:2024/05/15 00:34

时序数据库InfluxDB

官网:https://www.influxdata.com/
参考文档:https://docs.influxdata.com/influxdb/v1.3/administration/config/#configuration-options-overview

  • 简介
    InfluxDB支持的时间级别到了纳秒(ns),所以到数据的操作也应该到纳秒级。
  • http的使用
    • GET: SELECT* SHOW
    • POST: ALTER CREATE DELETE DROP GRANT KILL REVOKE
  • 关键字
    • epoch[ns,u,µ,ms,s,m,h]
      设置时间显示格式,默认为UTC(2017-12-21T14:09:07.435Z), 添加epoch将显示为时间戳
  • 使用

    • 创建数据库
    • 创建数据表
    • 增添数据

      +-----------+--------+-+---------+-+---------+|measurement|,tag_set| |field_set| |timestamp|+-----------+--------+-+---------+-+---------+measurement :等同于tabletag_set     :列名,所有的tag都会被索引field_set   :列名,不会被索引timestamp   :时间戳,如果不传值,influxdb在写入该point的时候,会自动生成//上面四个字段每一组都用“ ”分开eg: insert Table,tag1=xx,tag2=xx,tag3=xx field1=xx,filed2=xx,filed3=xx timestamp    
    • 修改数据

    • 删除数据
    • 查找数据
    • 命令行
      //根据时间排序,查找10条数据select * from table order by time desc limit 10//now(), 时间单位[ns,u,µ,ms,s,m,h]select * from table where time>now()-1h

参考文档:https://yq.aliyun.com/articles/104243

Filter(过滤)
select * from table where cloumn0=’xx’ and cloumn1=’xx’

Aggregation(聚合) : SUM AVG Max TopN等
select avg(x) from table group by cloumn0
说明:group by 是基于相同时间粒度做聚合; pre-aggregation(预聚合,数据实时写入后就经过预聚合运算),提搞效率

Downsampling(降精度),Rollup(汇总)和Auto-rollup(自动汇总)
downsampling from interval(10) to interval(30), //10秒精度的数据聚合成30秒精度的数据

原创粉丝点击