{{{ #!html
Cassandra 安裝與測試
0.8.1
}}} [[PageOutline]] == 1. download == 下載 bin 版如 [http://ftp.twaren.net/Unix/Web/apache//cassandra/0.8.1/apache-cassandra-0.8.1-bin.tar.gz apache-cassandra-0.8.1-bin.tar.gz] == 2. single setup == {{{ mkdir /opt/cassandra/run }}} * 修改 bin/cassandra.in.sh {{{ #!text JAVA_HOME=/usr/lib/jvm/java-6-sun CASSANDRA_HOME=/opt/cassandra }}} * 修改 conf/cassandra-env.sh {{{ #!text max_heap_size_in_mb=1024 }}} * 修改 conf/log4j-server.properties {{{ #!text log4j.appender.R.File=/opt/cassandra/run/system.log }}} * 修改 conf/cassandra.yaml {{{ #!text 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]; }}} {{{ #!text set Users[jsmith][first] = 'John'; \ \ \ \ \ \_ key \ \_ value \ \_ column \_ column family }}} == ps. 注意 == * Cassandra0.6.x 以後版本,預設相容於 Hadoop0.20.x * thrift * hadoop * json