cassandra-cliを試してみる
コマンドラインからcassandraを試してみる。
いくつかコマンドを確認してみる。
まずは、ログインしてみる。
こんなかんじや $cassandra-cli --host localhost --port 9160 Connected to: "Test Cluster" on localhost/9160 Welcome to cassandra CLI. Type 'help' or '?' for help. Type 'quit' or 'exit' to quit. cassandra> こんなかんじでもつながる $cassandra-cli Welcome to cassandra CLI. Type 'help' or '?' for help. Type 'quit' or 'exit' to quit. # サーバに接続 cassandra>connect localhost/9160 Connected to: "Test Cluster" on localhost/9160
いろいろ試してみる
# APIバージョン cassandra> show api version 2.2.0 # クラスタ名 cassandra> show cluster name Test Cluster # keyspace名 cassandra> show keyspaces Keyspace1 system # keyspaceの定義情報 cassandra> describe keyspace Keyspace1 Keyspace1.Super1 Column Family Type: Super Columns Sorted By: org.apache.cassandra.db.marshal.BytesType@5867df9 Column Family Type: Super Column Sorted By: org.apache.cassandra.db.marshal.BytesType flush period: null minutes ------
データを書き込み、読み取る
データを設定する cassandra> set Keyspace1.Standard2['michibatajessica']['first'] = 'Michibata' Value inserted. cassandra> set Keyspace1.Standard2['michibatajessica']['last'] = 'Jessica' Value inserted. cassandra> set Keyspace1.Standard2['michibatajessica']['age'] = '25' Value inserted. データを読み込む cassandra> get Keyspace1.Standard2['michibatajessica'] => (column=last, value=Jessica, timestamp=1291945890096000) => (column=first, value=Michibata, timestamp=1291945890083000) => (column=age, value=25, timestamp=1291945890915000) Returned 3 results. cassandra> get Keyspace1.Standard2['michibatajessica']['first'] => (column=first, value=Michibata, timestamp=1291945890083000) 他には、「del」「count」ができるみたいです。
おまけ
メモリ使用状況をアップしておきます。
(freeコマンドの内容です。)
total | used | free | shared | buffers | cached | |
---|---|---|---|---|---|---|
Mem: | 510532 | 487836 | 22696 | 0 | 55648 | 31860 |
buffers/cache: | 400328 | 110204 | ||||
Swap: | 2048276 | 110368 | 1937908 |
では!