wiki:waue/2011/0707

Version 2 (modified by waue, 10 years ago) (diff)

--

Cassandra 安裝與測試
0.8.1

1. download

下載 bin 版如 apache-cassandra-0.8.1-bin.tar.gz

2. single setup

  • 修改 conf/cassandra_env.sh
    max_heap_size_in_mb=1024
    
  • 修改 conf/log4j-server.properties
    log4j.appender.R.File=/opt/cassandra/run/system.log
    
  • 修改 conf/cassandra.yaml
    data_file_directories: /opt/cassandra/run/data
    commitlog_directory: /opt/cassandra/run/commitlog
    saved_caches_directory: /opt/cassandra/run/saved_caches
    

3. run

bin/cassandra  
...(程序跑於背景)

bin/cassandra-cli
[default@unknown] (進入指令交談模式)

4. 操作

create keyspace Keyspace1;

use Keyspace1;

create column family Users with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;

set Users[jsmith][first] = 'John';

set Users[jsmith][last] = 'Smith';

set Users[jsmith][age] = long(42);

get Users[jsmith];
  set Users[jsmith][first] = 'John';
        \      \        \          \
         \      \_ key   \          \_ value
          \               \_ column
           \_ column family

ps. 注意

  • 在Cassandra0.6.x中,​​默認實現的是與Hadoop0.20.x的整合