本文介绍了InfluxDB:一次存储数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

InfluxDB理想的数据存储方式如下:

InfluxDB ideal way of storing data looks like the following:

* temperature
timestamp,iotid,value
----------------------------
1501230195,iot1,70

* humidity
timestamp,iotid,value
-------------------------
1501230195,iot1,45

* pressure
timestamp,iotid,value
-------------------------
1501230195,iot1,850

像这样在单个测量中存储数据有多糟糕?

How bad is to store data in a single measurement like so?

* data
timestamp,iotid,measure,value
----------------------------
1501230195, iot1, temperare, 70
1501230195, iot1, humidity, 45
1501230195, iot1, pressure, 850

我的问题是,我还需要查询按时间戳排序的所有度量的从日期x到日期y的日志,但是我无法使用单独的度量来进行记录.

My problem is that I would also need to query the log from date x to date y of all my measures ordered by timestamp, but I can't do it using separate measurements.

推荐答案

根据官方文档:"> https://docs.influxdata.com/influxdb/v1.7/concepts/schema_and_data_layout/.这取决于用例.您的案例将数据保留在一个度量中是有意义的,因为它们具有相同的标签,它们还共享具有低基数的标签值+您将提到多次度量的查询问题.

There is no ideal/recommended way for this question according official doc: https://docs.influxdata.com/influxdb/v1.7/concepts/schema_and_data_layout/. It depends on the use case. Your case makes sense to keep data in one measurement, because they have the same tags, they share also tag values with nice low cardinality + you will have mentioned query issue with multiple measurements.

我在生产中具有约250M数据点(带有分片的多节点群集)的单测量设计,而性能没有问题.

I have single measurement design in production with ~250M data points (multi node cluster with sharding) and no problem with performance.

这篇关于InfluxDB:一次存储数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 18:21