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] quit;
Related Cassandra Articles: Apache Cassandra New Features Cassandra NoSQL Database Cassandra Query Language (CQL)
No comments:
Post a Comment