小编use*_*714的帖子

卡桑德拉范围查询

我是Cassandra的新手,正在尝试数据建模和范围查询.

出于学习目的,我想开发一个数据库,我可以在其中存储LogType和Log生成时间的日志行.我必须回答以下问题:

按日期范围之间的LogType查找日志.

我将我的数据库建模为2个列族:1)日志

create column family log with comparator = 'UTF8Type' 
and key_validation_class = 'LexicalUUIDType'
and column_metadata=[{column_name: block, validation_class: UTF8Type}];
Run Code Online (Sandbox Code Playgroud)

我打算用他们的logid来存储日志行

例如: set log['7561a442-24e2-11df-8924-001ff3591711'][blocks]='someText|11-17-2011 23:40:42|sometext';

2)

create column family ltype with column_type = 'Super'
and comparator = 'TimeUUIDType'
and subcomparator = 'UTF8Type'
and column_metadata=[{column_name: id, validation_class: LexicalUUIDType}];
Run Code Online (Sandbox Code Playgroud)

在此列系列中,我将存储日志类型以及时间和日志列系列中的日志行ID:

ex: set ltype[ltype1][12307245916538][id]='7561a442-24e2-11df-8924-001ff3591711';
Run Code Online (Sandbox Code Playgroud)

我想在给定日志和日期范围的类型时得到结果.

有人可以指导我如何在超级列族上运行范围查询吗?

cassandra

5
推荐指数
1
解决办法
5231
查看次数

标签 统计

cassandra ×1