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

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

问题描述

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

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.

例如,我们需要检索日期时间 dt1 和日期时间 dt2 之间的对象.

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

我们目前正在考虑将创建的unix时间戳作为指向实际对象的键,然后使用get_key_range查询检索?

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.

一般来说,这是在 noSQL 存储中执行日期时间的最佳方法吗?

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

推荐答案

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

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".

否则,是的,使用范围查询(get_key_range 在 0.5 中已弃用;使用 get_range_slice)是您的最佳选择.

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天全站免登陆