Version 2 (modified by waue, 13 years ago) (diff) |
---|
cassandra + thrift + python
cassandra 0.8.1 + thrift 0.6.1 + python 2.6
Download Thrift and Cassandra
- 下載 cassandra-0.8.1 於 /opt/cassandra-0.8.1
- thrift-0.6.1 於 /opt/cassandra-0.8.1/thrift-0.6.1
cassandra 是 java 因此只需要驅動即可,但thrift 是中介平台,因此需要make install 來加載到各語言的函式庫
之後在 cassandra 的資料夾下執行 gen-語言 則會產生該語言的驅動檔,透過驅動檔使用
install thrift
cd /opt/cassandra-0.8.1/thrift-0.6.1 ./configure make make install
注意 /usr/lib/python2.6/site-packages/thrift/ 內有資料才是 thrift python 安裝完成
generate gen-py
cd /opt/cassandra-0.8.1/interface thrift -gen py cassandra.thrift cd gen-py/cassandra
use
./Cassandra-remote -h cass-1:9160 insert Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" apple 1 ConsistencyLevel.QUORUM