March 4, 2017

cassandra-cli Commands

cassandra cli (Cassandra Command Line Interface) Commands

$ bin/cassandra-cli

$ bin/cassandra-cli --host localhost

[default@unknown] help;

[default@unknown] ? 

[default@unknown] connect localhost/9160;

[default@unknown] create keyspace demo;

[default@unknown] drop keyspace demoks;
[default@unknown] describe keyspace demo;
[default@unknown] describe cluster;

[default@unknown] use demo;
[default@demo] create column family test with comparator=UTF8Type and default_validation_class=UTF8Type;
[default@demo] create column family users with comparator=UTF8Type
and column_metadata=[{column_name: full_name, validation_class: UTF8Type}, {column_name: birth_date, validation_class: LongType, index_type: KEYS}];
[default@demo] drop column family test;
[default@demo] update column family users with comparator=UTF8Type
 and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
 {column_name: birth_date, validation_class: LongType, index_type: KEYS}, {column_name: state, validation_class: UTF8Type, index_type: KEYS}];

[default@demo] set test[row1][col1] = 'val1';
[default@demo] set test[row1][col2] = 'val2' with ttl=120;
[default@demo] set users[prothfuss][full_name] = 'Satya';
[default@demo] set users[prothfuss][birth_date] = 1983
[default@demo] get test[row1];
[default@demo] get users where birth_date = 1945;
[default@demo] get users where state = 'UT' and birth_date > 1980;

[default@demo] list output_words;


show keyspaces
show cluster name
show api version

[default@demo] exit;
[default@demo] quit;

Related Articles: Apache Cassandra New Features   Cassandra NoSQL Database  Cassandra Query Language (CQL)

1 comment:

  1. Posting it is very needed because every human being today want this information. Keep it up. Good luck and thanks for posting CSM Training in Bangalore | CSM Training Courses in Bangalore

    ReplyDelete