行键为 long 类型
有没有办法在 Cassadra 中将数字(longtype)存储为行键?
我想根据行键值执行范围查询。例如 $list info[12345:]; 。它应该列出所有 >= 12345 的行键。
有没有办法在 cassandra 中实现这一点?二级索引对我没有帮助。所以我试图在这里将列值“ip”存储为行键。
数据模型:
create keyspace ipinfo with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy' and strategy_options =
[{replication_factor:1}];
use rng;
create column family info with comparator = AsciiType
and key_validation_class = UTF8Type
and column_metadata =
[{
column_name : domain,
validation_class : UTF8Type,
index_type : 0,
index_name : domain_idx},
{
column_name : ip,
validation_class : LongType,
index_type : 0,
index_name : ip_idx
}];
谢谢 塔米日
Is there a way to store number(longtype) as row key in Cassadra?
I wanted to execute range query based on row key value. e.g $list info[12345:]; . It should list all the rowkeys which are >= 12345.
Is there a way accompolish this in cassandra? Secondary index does not helped me. So I am trying to store column value 'ip' as rowkey here.
data model:
create keyspace ipinfo with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy' and strategy_options =
[{replication_factor:1}];
use rng;
create column family info with comparator = AsciiType
and key_validation_class = UTF8Type
and column_metadata =
[{
column_name : domain,
validation_class : UTF8Type,
index_type : 0,
index_name : domain_idx},
{
column_name : ip,
validation_class : LongType,
index_type : 0,
index_name : ip_idx
}];
Thanks
Thamizh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为记录,这里是 Cassandra 用户列表上的线程,其中回答了这个问题: http://comments.gmane.org/gmane.comp.db.cassandra.user/20066
For the record, here is the thread on the Cassandra user list where this was answered: http://comments.gmane.org/gmane.comp.db.cassandra.user/20066