【问题标题】:Set Super Column Family in Cassandra Cli在 Cassandra Cli 中设置超级列族
【发布时间】:2011-07-26 19:07:21
【问题描述】:

我正在使用 Cassandra 0.8.0。

我不知道如何使用 Cassandra-Cli 向当前存在的 SuperColumn 添加值。例如:我已将以下内容添加到我的密钥空间中

create column family authors
with comparator = UTF8Type and subcomparator = UTF8Type
and default_validation_class = UTF8Type
and column_metadata = [{
    column_name: tags, validation_class: UTF8Type},
    {column_name: url, validation_class:UTF8Type},
    {column_name: title, validation_class: UTF8Type},
    {column_name: publisher, validation_class: UTF8Type},
    {column_name: email, validation_class: UTF8Type}];

我尝试在这个超级列中添加一行: (输入)[default@testspace] set authors[1]['1']['url'] = 'www.henry.com';

(输出)[default@testspace] null 这是一个错误^

我也试试这个:

[default@testspace] set authors['henry']['url']['1'] = 'www.henry.com';

然后得到:

org.apache.cassandra.db.marshal.MarshalException: cannot parse 'henry' as hex bytes

在 Cassandra-Cli 中操作 SuperColumns 的正确语法是什么?您能否提供一个在 cassandra-cli 中使用超列设置/获取值的示例?

谢谢

【问题讨论】:

    标签: cassandra command-line-interface super-columns


    【解决方案1】:

    你需要添加

    column_type = 'Super' and key_validation_class = UTF8Type
    

    到您的列族定义。

    【讨论】:

    • 感谢您的回复。如果 Cassandra 支持在超级列中索引子列,你会支持吗?
    【解决方案2】:

    您不能在超级列的子列上创建二级索引。因此,超级列的使用最适合子列数量相对较少的用例。

    【讨论】:

      猜你喜欢
      • 2013-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-22
      • 1970-01-01
      • 2011-09-11
      • 2013-03-19
      相关资源
      最近更新 更多