DataStax DevCenter라는 Cassandra의 CQL 툴(GUI 툴) 소개

DataStax DevCenter라는 Cassandra의 CQL 툴(GUI 툴)을 소개합니다.
※Oracle에서 말하는 「SQL Developer」등에 해당하는 툴입니다.



① DataStax Academy 계정을 생성한다.



Create new account | DataStax Academy: Free Cassandra Tutorials and Training
htps : // 아카데미. 단 s x. 코 m / 우세 r / 레기 s r? s 치나치온 = 칭찬

②『DataStax DevCenter』를 다운로드한다.





③ system keyspace 로 시스템 일자와 TimeUUID를 취득해 본다.



QuerySELECT dateof(now()) as sysdate, now() as timeuuid FROM system.local;
Result


sysdate
timeuuid


2018-02-16 07:30:30+0000
44529f03-12eb-11e8-9fb5-fddf3f702750



다음은 CQL 명령의 샘플입니다.

keyspace 만들기



Query
CREATE KEYSPACE [keyspace_name] WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

keyspace 확인(cqlsh>에서 실행)



QueryDESCRIBE KEYSPACE [keyspace_name];DESC KEYSPACE [keyspace_name];
Result
CREATE KEYSPACE keyspace_name WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

keyspace 삭제



QueryDROP KEYSPACE [keyspace_name];

표 만들기



Query
CREATE TABLE keyspace_name.table_name (
    column_id uuid,
    column_str text,
    column_int int,
    column_data text,
    PRIMARY KEY (column_id, column_str, column_int)
);

표 확인(cqlsh>에서 실행)



QueryDESCRIBE KEYSPACE [keyspace_name];DESC KEYSPACE [keyspace_name];
Result
CREATE KEYSPACE keyspace_name WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

CREATE TABLE keyspace_name.table_name (
    column_id uuid,
    column_str text,
    column_int int,
    column_data text,
    PRIMARY KEY (column_id, column_str, column_int)
) WITH CLUSTERING ORDER BY (column_str ASC, column_int ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair_chance = 0.0
    AND speculative_retry = '99.0PERCENTILE';

표 삭제



QueryDROP TABLE keyspace_name.table_name;

INSERT



Query
INSERT INTO keyspace_name.table_name (column_id, column_str, column_int, column_data) 
VALUES (44529f03-12eb-11e8-9fb5-fddf3f702750, 'String', 1, 'Data');

SELECT



QuerySELECT * FROM keyspace_name.table_name WHERE column_id = 44529f03-12eb-11e8-9fb5-fddf3f702750;
Result


column_id
column_str
column_int
column_data


44529f03-12eb-11e8-9fb5-fddf3f702750
문자열
1
데이터


같은 KEY의 INSERT (UPDATE된다)



Query
INSERT INTO keyspace_name.table_name (column_id, column_str, column_int, column_data) 
VALUES (44529f03-12eb-11e8-9fb5-fddf3f702750, 'String', 1, 'INSERT(UPDATE)');

Result


column_id
column_str
column_int
column_data


44529f03-12eb-11e8-9fb5-fddf3f702750
문자열
1
INSERT(UPDATE)


UPDATE



Query
UPDATE keyspace_name.table_name SET column_data = 'UPDATE' 
WHERE column_id = 44529f03-12eb-11e8-9fb5-fddf3f702750 AND column_str = 'String' AND column_int = 1;

Result


column_id
column_str
column_int
column_data


44529f03-12eb-11e8-9fb5-fddf3f702750
문자열
1
UPDATE


DELETE



Query
DELETE FROM keyspace_name.table_name 
WHERE column_id = 44529f03-12eb-11e8-9fb5-fddf3f702750 AND column_str = 'String' AND column_int = 1;

TRUNCATE



QueryTRUNCATE keyspace_name.table_name;

참고 링크


  • CQL 명령

  • 결론



    Qiita의 [cql][cqlsh] 의 태그에 아이콘이 없었기 때문에, Qiita의 아이콘을 모방해 디자인해 보았다!
    꽤 좋은 할 수 있다! 라고 생각하면 「좋다!」를 부탁합니다!


  • <참고 링크> Qiita 태그 아이콘 정보
  • 좋은 웹페이지 즐겨찾기