| 1 | cassandra + thrift + python |
| 2 | |
| 3 | = Download Thrift and Cassandra = |
| 4 | * 下載 cassandra-0.8.1 於 /opt/cassandra-0.8.1 |
| 5 | * thrift-0.6.1 於 /opt/cassandra-0.8.1/thrift-0.6.1 |
| 6 | |
| 7 | cassandra 是 java 因此只需要驅動即可,但thrift 是中介平台,因此需要make install 來加載到各語言的函式庫 |
| 8 | |
| 9 | 之後在 cassandra 的資料夾下執行 gen-語言 則會產生該語言的驅動檔,透過驅動檔使用 |
| 10 | |
| 11 | = install thrift = |
| 12 | |
| 13 | {{{ |
| 14 | cd /opt/cassandra-0.8.1/thrift-0.6.1 |
| 15 | ./configure |
| 16 | make |
| 17 | make install |
| 18 | }}} |
| 19 | |
| 20 | 注意 /usr/lib/python2.6/site-packages/thrift/ 內有資料才是 thrift python 安裝完成 |
| 21 | |
| 22 | = generate gen-py = |
| 23 | {{{ |
| 24 | cd /opt/cassandra-0.8.1/interface |
| 25 | thrift -gen py cassandra.thrift |
| 26 | cd gen-py/cassandra |
| 27 | }}} |
| 28 | |
| 29 | = use = |
| 30 | {{{ |
| 31 | ./Cassandra-remote -h cass-1:9160 insert Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" apple 1 ConsistencyLevel.QUORUM |
| 32 | }}} |