Why doesn't processing and pasting from the CLIS Cassandra tutorial work?

Following a bit of http://wiki.apache.org/cassandra/CassandraCli , and can anyone explain this?

aaron-mac:apache-cassandra-1.0.0 aaron$ bin/cassandra-cli -host localhost -port 9160
Connected to: "Test Cluster" on localhost/9160
Welcome to the Cassandra CLI.

Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.

[default@unknown] use Keyspace1;
Authenticated to keyspace: Keyspace1

[default@Keyspace1] create column family User with comparator = UTF8Type; 
5ef4bad0-fb2a-11e0-0000-242d50cf1ffd
Waiting for schema agreement...
... schemas agree across the cluster
[default@Keyspace1] set User['jsmith']['first'] = 'John'; 
org.apache.cassandra.db.marshal.MarshalException: cannot parse 'jsmith' as hex bytes
[default@Keyspace1] 
+5
source share
3 answers

Before running any set command in the Cassandra CLI, it is always recommended that you do the following:

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

This ensures that everything you install and list is understood.

PS: This is only for beginners in Cassandra

+21
source

This is for an older version of Cassandra. Keys are now treated as default hexadecimal bytes, so you need to:

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

or do:

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

Or, as noted in the document in the document:

. Cassandra 0.8, _validation_class :

update column family User with key_validation_class=UTF8Type;
+4
set User['jsmith'][utf8('first')] = utf8('John');

If you are not sure about the command set, you can enter help set;and it will show the full documentation.

+1
source

All Articles