Why does cutting and pasting from the Cassandra CLI tutorial not work?

前端 未结 3 1706
执笔经年
执笔经年 2021-02-03 15:02

Blindly following http://wiki.apache.org/cassandra/CassandraCli, and can someone please explain this?

aaron-mac:apache-cassandra-1.0.0 aaron$ bin/cassandra-cli          


        
相关标签:
3条回答
  • 2021-02-03 15:41

    Before you run any set command in Cassandra CLI, it is always advisable to do the following :

    assume <column_family> keys as utf8;
    assume <column_family> comparator as utf8;
    assume <column_family> validator as utf8;
    

    This will ensure that everything you set and list will be understood

    P.S : This is only for newcomers to Cassandra

    0 讨论(0)
  • 2021-02-03 15:46
    set User['jsmith'][utf8('first')] = utf8('John');
    

    If you're unsure about the set command you can type help set; and it'll show the full documentation.

    0 讨论(0)
  • 2021-02-03 15:52

    That's for an older version of Cassandra. Keys are now treated as hex bytes by default, so you need:

    set User[utf8('jsmith')]['first'] = 'John';
    

    or do:

    assume User keys as utf8;
    set User['jsmith']['first'] = 'John';
    

    Or, as the note in the doc says:

    Note: As of Cassandra 0.8, we need to declare a key_validation_class for the column family:

    update column family User with key_validation_class=UTF8Type;
    
    0 讨论(0)
提交回复
热议问题