【问题标题】:Unable to retrieve data from Cassandra无法从 Cassandra 检索数据
【发布时间】:2013-03-31 20:35:28
【问题描述】:

退出 cli 后,我无法从 Cassandra 检索数据。当我在另一个会话中返回获取数据时,我收到此错误:

org.apache.cassandra.db.marshal.MarshalException: 无法将“jsmith”解析为十六进制字节

似乎列族和键空间也保留了。

我还将密钥格式更改为 ascii(假设用户密钥为 ascii;)...这也不会保持设置。

有什么原因吗?怎么回事?

【问题讨论】:

    标签: ubuntu cassandra


    【解决方案1】:

    所有“假设”命令都是临时的,并且仅限于单个 cli 会话。对于那些现在没有坐在 cli 前面的人,我们指的是这些:

    assume <cf> comparator as <type>;
    assume <cf> sub_comparator as <type>;
    assume <cf> validator as <type>;
    assume <cf> keys as <type>;
    
    Assume one of the attributes (comparator, sub_comparator, validator or keys)
    of the given column family match specified type. The specified type will
    be used when displaying data returned from the column family.
    

    这些是纯粹的客户端

    您想要做的是将元数据永久记录在 ColumnFamily 定义中,例如来自自述文件,

    create column family Users with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;
    

    这在三个方面与“假设”不同:

    1. 它被永久记录在 Cassandra 中
    2. Cassandra 将对插入的数据强制执行指定类型
    3. 所有客户端都可以查询并使用此元数据来执行智能操作,而不仅仅是 cli

    假设主要是作为旧数据集的一种解决方法,这些旧数据集无法更新为使用“真正的”服务器端类型。

    【讨论】:

      猜你喜欢
      • 2017-05-21
      • 2015-03-22
      • 2012-03-12
      • 2019-09-24
      • 2014-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多