时间序列数据库之InfluxDB

InfluxDB is an open source distributed time series database

there are two major types of time-series data:

• Regular – data that is sampled at regular intervals. For example every second, or every hour.
• Irregular – data that is only recorded when an event occurs, which might happen frequently, but always at completely random times.

规则: 定时比如每秒钟,每小时抽样数据. 不规则: 当事件发生时才记录.

Schema

• Measurements (e.g. cpu, temperature, event, memory)
• Tags (e.g. region=uswest, host=serverA, sensor=23)
• Fields (e.g. value=23.2, info=’this is some extra stuff’, present=true)
• Timestamp (nano-second epoch)

All data is indexed by measurement, tagset, and time

• Data bases –> MySQL,PG
• Time series –> Table
• Points or Events –> Row

Data in InfluxDB is organized by time series, which contain a measured value, like “cpu_load” or “temperature”.
Time series have zero to many points, one for each discrete sample of the metric.
Points consist of time (a timestamp), a measurement (“cpu_load”),
at least one key-value field (the measured value itself, e.g. “value=0.64” or “15min=0.78”),
and zero to many key-value tags containing metadata (e.g. “host=server01”, “region=EMEA”, “dc=Frankfurt”).

A point with the measurement name of cpu and tag host, with the measured value of 0.64

Write and Query

Conceptually you can think of a measurement as an SQL table, with rows where the primary index is always time.
tags and fields are effectively columns in the table. tags are indexed, fields are not.