Unable to retrieve data from Cassandra

前端 未结 1 1957
南旧
南旧 2021-02-14 08:15

I cannot retrieve data from Cassandra after I exit the cli. When I go back to get the data in another session, I get this error:

org.apache.cassandra.db.marshal.MarshalE

相关标签:
1条回答
  • 2021-02-14 09:21

    All of the "assume" commands are temporary and limited to a single cli session. For those not sitting in front of the cli right now, we're referring to these:

    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.
    

    These are purely client side.

    What you want to do instead is to record that metadata permanently in the ColumnFamily definition, e.g. from the readme,

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

    This is different from "assume" in 3 ways:

    1. It is permanently recorded in Cassandra
    2. Cassandra will enforce the specified type against data inserted
    3. All clients can query and use this metadata to do intelligent things with it, not just the cli

    Assume is primarily there as a workaround for old data sets that cannot be updated to use a "real" server-side type.

    0 讨论(0)
提交回复
热议问题