Cassandraをインストールしてみた
前々から気になっていたCassandra。
Cassandraとは何かというのは、いろいろと説明しているページがあるので
そちらに譲るとして0.8.0がリリースされたみたいなのでインストールしてみた。
http://cassandra.apache.org/download/
とりあえず、Windowsで動かしてみようとCドライブ直下に解凍してみた。
[スペック]
OS:Windows XP Professional
メモリ:1.86GByte
java:Sun JDK 1.6.0_24
binフォルダのcassandra.batをダブルクリックしてみる。
すると、コンソールに以下のメッセージが表示された。
Starting Cassandra Server
INFO 18:22:34,166 Logging initialized
INFO 18:22:34,213 Heap size: 1067057152/1067057152
INFO 18:22:34,229 JNA not found. Native methods will be disabled.
INFO 18:22:34,260 Loading settings from file:/C:/apache-cassandra-0.8.0/conf/cassandra.yaml
INFO 18:22:34,588 DiskAccessMode 'auto' determined to be standard, indexAccessMode is standard
INFO 18:22:34,885 Global memtable threshold is enabled at 339MB
INFO 18:22:35,166 Creating new commitlog segment /var/lib/cassandra/commitlog\CommitLog-1309080155166.log
INFO 18:22:35,400 Couldn't detect any schema definitions in local storage.
INFO 18:22:35,400 Found table data in data directories. Consider using the CLIto define your schema.
INFO 18:22:35,447 No commitlog files found; skipping replay
INFO 18:22:35,463 Upgrading to 0.7. Purging hints if there are any. Old hints will be snapshotted.
INFO 18:22:35,479 Cassandra version: 0.8.0
INFO 18:22:35,479 Thrift API version: 19.10.0
INFO 18:22:35,479 Loading persisted ring state
INFO 18:22:35,479 Starting up server gossip
INFO 18:22:35,510 Enqueuing flush of Memtable-LocationInfo@4889213(227/283 serialized/live bytes, 4 ops)
INFO 18:22:35,525 Writing Memtable-LocationInfo@4889213(227/283 serialized/live bytes, 4 ops)
INFO 18:22:35,682 Completed flushing \var\lib\cassandra\data\system\LocationInfo-g-1-Data.db (335 bytes)
INFO 18:22:35,775 Starting Messaging Service on port 7000
WARN 18:22:35,900 Generated random token 48012882935487630546980996504460283833. Random tokens will result in an unbalanced ring; see http://wiki.apache.org/cassandra/Operations
INFO 18:22:35,916 Enqueuing flush of Memtable-LocationInfo@17097355(53/66 serialized/live bytes, 2 ops)
INFO 18:22:35,916 Writing Memtable-LocationInfo@17097355(53/66 serialized/livebytes, 2 ops)
INFO 18:22:36,072 Completed flushing \var\lib\cassandra\data\system\LocationInfo-g-2-Data.db (163 bytes)
INFO 18:22:36,088 Will not load MX4J, mx4j-tools.jar is not in the classpath
INFO 18:22:36,213 Binding thrift service to localhost/127.0.0.1:9160
INFO 18:22:36,213 Using TFastFramedTransport with a max frame size of 15728640bytes.
INFO 18:22:36,229 Listening for thrift clients...
コミットログ等の出力場所を正しく設定する必要があるみたいですね。。。
次にクライアントツールを起動してみます。
binフォルダ配下にあるcassandra-cli.batをダブルクリックしてみます。
Starting Cassandra Client
Welcome to the Cassandra CLI.Type 'help;' or '?' for help.
Type 'quit;' or 'exit;' to quit.[default@unknown]
ここで以下のコマンドを入力し、Cassandraサーバに接続してみます。
[default@unknown] connect localhost/9160;
Connected to: "Test Cluster" on localhost/9160
systemというkeyspaceを表示してみる。
[default@unknown] describe keyspace system;
Keyspace: system:
Replication Strategy: org.apache.cassandra.locator.LocalStrategy
Options: [replication_factor:1]
Column Families:
ColumnFamily: HintsColumnFamily (Super)
"hinted handoff data"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType/org.apache.cassandra.db.marshal.BytesType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.15/32/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
ColumnFamily: IndexInfo
"indexes that have been completed"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.0375/8/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
ColumnFamily: LocationInfo
"persistent metadata for the local node"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.0375/8/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
ColumnFamily: Migrations
"individual schema mutations"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.TimeUUIDType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.0375/8/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
ColumnFamily: NodeIdInfo
"nodeId and their metadata"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.TimeUUIDType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.0375/8/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
ColumnFamily: Schema
"current state of the schema"
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.01/0
Memtable thresholds: 0.0375/8/1440 (millions of ops/MB/minutes)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: true
Built indexes:
[default@unknown]
何となく動いているみたい。
今度は設定ファイルの内容を修正して、データの投入をしてみよう。
SQLならぬCQLというのもあるようだ。今度試してみよう。