无法从Cassandra检索数据


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

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

看来列家族和密钥空间都保留了下来。

我还将密钥格式更改为ascii(假设用户密钥为ascii;(。。。这也没有固定下来。

为什么?发生了什么事?

所有"假定"命令都是临时的,仅限于单个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. 它被永久记录在卡桑德拉
  2. Cassandra将对插入的数据强制执行指定的类型
  3. 所有客户端都可以查询并使用此元数据,而不仅仅是cli

假设主要是作为无法更新为使用"真实"服务器端类型的旧数据集的变通方法。

最新更新