Tuesday, April 9, 2013
Cassandra Basic Use~!
this is basic Guide for users who start it first time
follow step by step from top to bottom
// make keyspace
[default@unknown] create keyspace MyKeyspace with placement_strategy='org.apache.cassandra.locator.SimpleStrategy' and strategy_op
tions ={replication_factor:1};
use MyKeyspace
// make column fammily
create column family User with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;
// insert data
[default@MyKeyspace] set User['song']['fname']='moo chan';
Value inserted.
Elapsed time: 36 msec(s).
[default@MyKeyspace] set User['song']['email']='ehewitt@example.com';
Value inserted.
// count data
[default@MyKeyspace] count User['song'];
2 columns
// get data
[default@MyKeyspace] get User['song'];
=> (column=email, value=ehewitt@example.com, timestamp=1365494876521000)
=> (column=fname, value=moo chan, timestamp=1365494847746000)
Returned 2 results.
Elapsed time: 28 msec(s).
// remove data
[default@MyKeyspace] del User['song']['email'];
column removed.
Elapsed time: 19 msec(s).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment