cassandra-cli

Nosql/cassandra 2016. 8. 1. 12:55

# cassandra-cli


1. 실행

- ~/bin/cassandra-cli -h host_name -p host_portnumber

2. cli 사용

- create :

- CREATE KEYSPACE hector_ks  

           with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'  

           and strategy_options = {replication_factor:3};

- CREATE COLUMN FAMILY hector_cf  

             WITH comparator = UTF8Type  

             AND key_validation_class=UTF8Type  

             AND column_metadata = [  

             {column_name: col1, validation_class: UTF8Type, index_type: KEYS}  

             {column_name: col2, validation_class: UTF8Type}  

             {column_name: col3, validation_class: UTF8Type}  

             {column_name: col4, validation_class: UTF8Type}  

             {column_name: col5, validation_class: UTF8Type}  

            ];

- insert :

-  SET hector_cf['rowkey1']['col1']='val1';

-  SET hector_cf['rowkey1'][utf8('extra_col')]=utf8('extra_val');

-  **column_metadata 에 추가하지 않은 값도 insert 가능하다 , 단 타입을 명시해야 한다**

- SET hector_cf['rowkey1'][col3] = 'SAVE20' WITH ttl=864000;

- ttl 단위는 초 이다

- update

- UPDATE COLUMN FAMILY hector_cf WITH comparator = UTF8Type AND column_metadata = [{column_name: col1, index_type: KEYS }];

- set hector_cf['rowkey1']['col1']='val00';

- insert == update 

- delete

- DEL hector_cf ['rowkey1']['col2'];

- DEL hector_cf ['rowkey1'];

- get :

- GET hector_cf[rowkey1][col1];

- GET hector_cf[rowkey1];

- GET hector_cf WHERE col1 = 'val1';

- key 로 선언한 컬럼에 대해 indexing 기능을 지원한다

'Nosql > cassandra' 카테고리의 다른 글

cassandra java client 소개 및 비교  (0) 2016.08.02
opscenter - cassandra monitor tool  (0) 2016.08.02
cassandra 간단 설치 및 multi cluster 구성하기  (0) 2016.08.02
cassandra cql 3.0  (0) 2016.08.01
cassandra date model  (0) 2016.08.01
Posted by 감각적신사
,