카산드라 설치

· 10년 전 · 1112

카산드라 설치 및 간단 사용법

 

[설치]

 

1.

 

cd /usr/local/src

wget http://mirror.apache-kr.org/cassandra/2.0.16/apache-cassandra-2.0.16-bin.tar.gz

tar xvzfp apache-cassandra-2.0.16-bin.tar.gz

mv apache-cassandra-2.0.16 /usr/local/

ln -s /usr/local/apache-cassandra-2.0.16 /usr/local/cassandra

 

 

2. 카산드라 데이터 로그 저장 디렉토리 생성

 

cd /usr/local/cassandra/  

mkdir /var/lib/cassandra

mkdir /var/log/cassandra

 

[실행]

 

1. 서버 시작

 

아래 처럼 나온다면 java  설치

 

/usr/local/cassandra/bin/cassandra -f

 

Cassandra 2.0 and later require Java 7 or later.

 

 

java 설치후 다시 실행.

/usr/local/cassandra/bin/cassandra -f

 

 

 

2. 커맨드라인 인터페이스 실행

 

cd /usr/local/cassandra/

bin/cassandra-cli

 

Connected to: "Test Cluster" on 127.0.0.1/9160

Welcome to Cassandra CLI version 2.0.9

 

The CLI is deprecated and will be removed in Cassandra 3.0.  Consider migrating to cqlsh.

CQL is fully backwards compatible with Thrift data; see http://www.datastax.com/dev/blog/thrift-to-cql3

 

Type 'help;' or '?' for help.

Type 'quit;' or 'exit;' to quit.

 

 

 

3. CLI

 

[default@unknown] help;

Getting around:

?                       Display this help.

help;                   Display this help.

help <command>;         Display command-specific help.

exit;                   Exit this utility.

quit;                   Exit this utility.

 

Commands:

assume                  Apply client side validation.

connect                 Connect to a Cassandra node.

consistencylevel        Sets consisteny level for the client to use.

count                   Count columns or super columns.

create column family    Add a column family to an existing keyspace.

create keyspace         Add a keyspace to the cluster.

del                     Delete a column, super column or row.

decr                    Decrements a counter column.

describe cluster        Describe the cluster configuration.

describe                Describe a keyspace and its column families or column family in current keyspace.

drop column family      Remove a column family and its data.

drop keyspace           Remove a keyspace and its data.

drop index              Remove an existing index from specific column.

get                     Get rows and columns.

incr                    Increments a counter column.

list                    List rows in a column family.

set                     Set columns.

show api version        Show the server API version.

show cluster name       Show the cluster name.

show keyspaces          Show all keyspaces and their column families.

show schema             Show a cli script to create keyspaces and column families.

truncate                Drop the data in a column family.

update column family    Update the settings for a column family.

update keyspace         Update the settings for a keyspace.

use                     Switch to a keyspace.

 

4. data read and write

 

- 클러스터 이름 확인

 

show cluster name;

Test Cluster

 

- 키스페이스 확인

 

show keyspaces;

 

WARNING: CQL3 tables are intentionally omitted from 'show keyspaces' output.

See https://issues.apache.org/jira/browse/CASSANDRA-4377 for details.

 

Keyspace: system:

 Replication Strategy: org.apache.cassandra.locator.LocalStrategy

 Durable Writes: true

 

..중략

 

- 키스페이스 생성

 

create keyspace FrankKeyspace

 

...     with strategy_options={replication_factor:1}

...     and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';

363d5a37-cb93-3092-b8ba-d9fdee25be6c

 

- 키스페이스 사용

 

use FrankKeyspace;

Authenticated to keyspace: FrankKeyspace

 

- 컬럼 패밀리 생성

 

create column family User

...     with comparator = UTF8Type

...     and default_validation_class = UTF8Type

...     and key_validation_class = UTF8Type;

587fb75e-1887-3365-860c-ad7b6c6ee451

 

- 데이터 write

 

 

set User['test']['name']='Frank';

Value inserted.

 

set User['test']['age']='38';

Value inserted.

 

 

 

- 데이터 확인

 

count User['test'];

2 cells

 

- 데이터 읽기

 

get User['test']['age'];

=> (name=age, value=38, timestamp=1405994554302000)

 

- 데이터 삭제

 

del User['test']['age'];

cell removed.

 

get User['test']['age'];

Value was not found

 

 

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

호스팅정보

+
제목 글쓴이 날짜 조회
10년 전 조회 752
10년 전 조회 805
10년 전 조회 731
10년 전 조회 757
10년 전 조회 782
10년 전 조회 551
10년 전 조회 1,191
10년 전 조회 894
10년 전 조회 940
10년 전 조회 1,031
10년 전 조회 837
10년 전 조회 857
10년 전 조회 1,274
10년 전 조회 765
10년 전 조회 918
10년 전 조회 987
10년 전 조회 1,020
10년 전 조회 830
10년 전 조회 1,113
10년 전 조회 979
10년 전 조회 858
10년 전 조회 862
10년 전 조회 1,035
10년 전 조회 926
10년 전 조회 1,346
10년 전 조회 1,154
10년 전 조회 959
10년 전 조회 1,254
10년 전 조회 893
10년 전 조회 1,447
🐛 버그신고