以下の内容はhttps://yohfee.hatenadiary.org/entry/20100522/1274542129より取得しました。


はじめてのCassandra

Ubuntu 10.04で。
まずはインストールから起動まで。
とりあえずお試しでホームディレクトリ下で動かしてみる。

% wget http://www.meisei-u.ac.jp/mirror/apache/dist/cassandra/0.6.1/apache-cassandra-0.6.1-bin.tar.gz
% tar xvfz apache-cassandra-0.6.1-bin.tar.gz
% cd apache-cassandra-0.6.1
% export CASSANDRA_HOME=`pwd`
% cp conf/storage-conf.xml conf/storage-conf.xml~
% diff conf/storage-conf.xml~ conf/storage-conf.xml
193c193
<   <CommitLogDirectory>/var/lib/cassandra/commitlog</CommitLogDirectory>
---
>   <CommitLogDirectory>$CASSANDRA_HOME/commitlog</CommitLogDirectory>
195c195
<       <DataFileDirectory>/var/lib/cassandra/data</DataFileDirectory>
---
>       <DataFileDirectory>$CASSANDRA_HOME/data</DataFileDirectory>
% cp conf/log4j.properties conf/log4j.properties~
% diff conf/log4j.properties~ conf/log4j.properties
35c35
< log4j.appender.R.File=/var/log/cassandra/system.log
---
> log4j.appender.R.File=$CASSANDRA_HOME/system.log
% bin/cassandra
 INFO 11:38:40,816 Auto DiskAccessMode determined to be standard
 INFO 11:38:41,282 Saved Token not found. Using 14634285769542601794195837855795427615
 INFO 11:38:41,282 Saved ClusterName not found. Using Test Cluster
 INFO 11:38:41,297 Creating new commitlog segment $CASSANDRA_HOME/commitlog/CommitLog-1274323121297.log
 INFO 11:38:41,410 Starting up server gossip
 INFO 11:38:41,543 Binding thrift service to localhost/127.0.0.1:9160

CLIがついてるんでさらっと試してみる。

% bin/cassandra-cli
Welcome to cassandra CLI.

Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.
cassandra> ?
List of all CLI commands:
?                                                                  Same as help.
help                                                          Display this help.
connect <hostname>/<port>                             Connect to thrift service.
describe keyspace <keyspacename>                              Describe keyspace.
exit                                                                   Exit CLI.
quit                                                                   Exit CLI.
show config file                                Display contents of config file.
show cluster name                                          Display cluster name.
show keyspaces                                           Show list of keyspaces.
show api version                                        Show server API version.
get <ksp>.<cf>['<key>']                                  Get a slice of columns.
get <ksp>.<cf>['<key>']['<super>']                   Get a slice of sub columns.
get <ksp>.<cf>['<key>']['<col>']                             Get a column value.
get <ksp>.<cf>['<key>']['<super>']['<col>']              Get a sub column value.
set <ksp>.<cf>['<key>']['<col>'] = '<value>'                       Set a column.
set <ksp>.<cf>['<key>']['<super>']['<col>'] = '<value>'        Set a sub column.
del <ksp>.<cf>['<key>']                                           Delete record.
del <ksp>.<cf>['<key>']['<col>']                                  Delete column.
del <ksp>.<cf>['<key>']['<super>']['<col>']                   Delete sub column.
count <ksp>.<cf>['<key>']                               Count columns in record.
count <ksp>.<cf>['<key>']['<super>']            Count columns in a super column.
cassandra> connect localhost/9160
Connected to: "Test Cluster" on localhost/9160
cassandra> set Keyspace1.Standard1['hoge']['foo']='X'
Value inserted.
cassandra> set Keyspace1.Standard1['hoge']['bar']='Y'_
Value inserted.
cassandra> get Keyspace1.Standard1['hoge']
=> (column=bar, value=Y, timestamp=1274323323091000)
=> (column=foo, value=X, timestamp=1274323304565000)
Returned 2 results.
cassandra> exit

次回、Rubyでちょす。




以上の内容はhttps://yohfee.hatenadiary.org/entry/20100522/1274542129より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14