时序数据库

InfluxDB 简单上手(一)

2020-03-20  本文已影响0人  逗逼程序员

背景

最近公司的监控项目中用到时序数据库,现在简单介绍学习以下,后面再详细研究。

什么是时序数据?

A time series database (TSDB) is a software system that is optimized for storing and serving time series through associated pairs of time(s) and value(s).In some fields, time series may be called profiles, curves, traces or trends. Several early time series databases are associated with industrial applications which could efficiently store measured values from sensory equipment (also referred to as data historians), but now are used in support of a much wider range of applications.

In many cases, the repositories of time-series data will utilize compression algorithms to manage the data efficiently. Although it is possible to store time-series data in many different database types, the design of these systems with time as a key index is distinctly different from relational databases which reduce discrete relationships through referential models.

简单说,时序数据库就是存储时间序列的数据,用来展示一定时期内的趋势、潮流。。。

时序数据库应用场景?

目前以广泛适用于Tesla 自动驾驶、华尔街自动交易算法、智能家居、能够实现日内闪电般运抵的交通网络和纽约市警察局发布的开放数据

在过去的 24 个月中,时间序列数据库(TSDB)已经成为增长最快的类别:

1.png

时序数据库类别增长趋势:

2.png

数据来源:https://db-engines.com/en/ranking_categories

现在可以支持技术选型 InfluxDB ;

InfluxDB 上手入门

1、首先假设你已经安装好InfluxDB (自行百度)

2、启动InfluxDB 命令行

进入: /influxdb-1.6.3-1/usr/bin
执行:./influx

3、概念解释

  • database 对应数据库中的库
  • measurement 对应数据库中的表
  • points 表里面的一行数据

Point由时间戳(time)、数据(field)和标签(tags)组成。

  • time:每条数据记录的时间,也是数据库自动生成的主索引;
  • fields:各种记录的值;
  • tags:各种有索引的属性。

还有一个重要的名词:series

所有在数据库中的数据,都需要通过图表来表示,series表示这个表里面的所有的数据 的图标展示。

4、基本操作

创建数据库

create database mydb

显示所有数据库

show databases;

使用数据库

use mydb;

显示该数据库中所有表

show measurements;

第一篇简单上手就到这里,后面逐步剖析原理实现。

语法参考:https://docs.influxdata.com/influxdb/v1.7/query_language/data_exploration/

上一篇下一篇

猜你喜欢

热点阅读