1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cassandraを使ってみる

Last updated at Posted at 2015-08-08

CassandraをWindowsで使ってみる

コマンドの確認

cassandra-cliで
help;
と入力

このあと
1 keyspaceの作成      (RDBでいうところのdatabaseの作成)
2 colum familyの作成    (RDBでいうところのtableの作成)
3 データの挿入        (RDBでいうところのinsert)
を行う

1 keyspaceの作成(RDBでいうところのdatabaseの作成)

Testという名前のkeyspaceの作成を行います。
(RDBでいうところのdatabaseの作成)
create keyspace Test;
(RDBだったらcreate database Test;)

作成したkeyspaceの選択を行います。
use Test;

2 colum familyの作成(RDBでいうところのtableの作成)

Userという名前のcolumn familyの作成を行います。
(RDBでいうところのtableの作成)
create column family User with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;
(column family をutf-8にするために
「with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;」をつけています。

(RDBだったらcreate database User;)

Test(keyspace)にUser(column family)が作成されているか確認します
describe Test;

3 データの挿入(RDBでいうところのinsert)

User(column family)にデータを挿入してみます。
set User['yamada']['email']='tanaka@tanaka.com'; set User['yamada']['tel']='08011112222';

データを取得してみます。
get Uesr['yamada'];

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?