Cassandra时间序列数据 [英] Cassandra time series data

查看:800
本文介绍了Cassandra时间序列数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Cassandra存储来自各种来源的信息流。



我们面临的一个问题是在两个日期之间进行查询的最佳方式。



例如,我们需要在datetime dt1和datetime dt2之间检索一个对象。



创建的unix时间戳作为指向实际对象的键,然后使用get_key_range查询检索?



显然,如果两个项目具有相同的时间戳,这将不起作用。 / p>

这是在一般的noSQL存储中做datetime的最好的方法吗?

解决方案

Cassandra行可能非常大,因此可以考虑将其建模为行中的列而不是CF中的行;那么您可以使用列切片操作,这比行切片快。如果没有与此相关的自然键,则可以使用每日或每小时的键,例如2010/02/08 13:00。



否则,使用范围查询(get_key_range在0.5中被弃用;使用get_range_slice)是你最好的选择。


We are looking at using Cassandra to store a stream of information coming from various sources.

One issue we are facing is the best way to query between two dates.

For example we will need to retrieve an object between datetime dt1 and datetime dt2.

We are currently considering the created unix timestamp as the key pointing to the actual object then using get_key_range to query to retrieve?

Obviously this wouldn't work if two items have the same timestamp.

Is this the best way to do datetime in noSQL stores in general?

解决方案

Cassandra rows can be very large, so consider modeling it as columns in a row rather than rows in a CF; then you can use the column slice operations, which are faster than row slices. If there are no "natural" keys associated with this then you can use daily or hourly keys like "2010/02/08 13:00".

Otherwise, yes, using range queries (get_key_range is deprecated in 0.5; use get_range_slice) is your best option.

这篇关于Cassandra时间序列数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆