Version 15 (modified by waue, 13 years ago) (diff) |
---|
cassandra 1.0 + Cassandra-PHP-Client-Library
前言
- 透過官方頁面得知,若使用以下專案可以免去安裝thrift的困擾
http://wiki.apache.org/cassandra/ClientOptions
- Cassandra PHP Client Library:
https://github.com/kallaspriit/Cassandra-PHP-Client-Library API Library Graph
- 順便對照以前寫得內容
hadoop + Hbase + thrift + php 安裝設定與程式設計
Cassandra
- 下載 cassandra 1.0 解開到 /opt/cassandra-1.0.1
- 安裝設定與啟動 cassandra 1.0
sudo mkdir /var/lib/cassandra /var/log/cassandra; sudo chmod 777 /var/lib/cassandra /var/log/cassandra cd /opt/cassandra-1.0.1 ./configure; make ; sudo make install bin/cassandra
PHP
- 下載 Cassandra-PHP-Client-Library (下載) ,解壓縮到 /var/www/cassandra/ 下
- 將 Cassandra-PHP-Client-Library-exp.php 放在 /var/www/cassandra/ 與專案的 Cassandra.php 同目錄,並於瀏覽器執行。
- 驗證
bin/cassandra-cli -h localhost use CassandraExample; show schema; list user;
- 結果
[default@CassandraExample] list user; Using default limit of 100 ------------------- RowKey: 6a616e652e646f65 => (column=age, value=24, timestamp=-126335541) => (column=email, value=jane@doe.com, timestamp=-126335541) => (column=name, value=Jane Doe, timestamp=-126335541) ------------------- RowKey: 636875636b => (column=age, value=24, timestamp=-126333665) => (column=email, value=chuck@norris.com, timestamp=-126333665) => (column=name, value=Chuck Norris, timestamp=-126333665) ------------------- RowKey: 6a6f686e => (column=age, value=34, timestamp=-126397246) => (column=email, value=john@smith.com, timestamp=-126397246) => (column=name, value=John Smith, timestamp=-126397246) 3 Rows Returned.
移除
清除以下兩個目錄
- /var/lib/cassandra
- /var/log/cassandra
cassandra 1.0 + Thrift 0.7
- cassandra 1.0 + Thrift 0.7 為 2011 / 11/ 08 可取得的最新版
- 官方文件說 cassandra 0.8 搭配 Thrift 0.6 , cassandra 0.7 <-> Thrift 0.5 .. ,沒註明 cassandra 1.0 用哪個版本http://wiki.apache.org/cassandra/InstallThrift
sudo apt-get install libboost-dev automake libtool flex bison pkg-config g++
專案 安裝目錄 cassandra 1.0 /opt/cassandra-1.0.1/ thrift 0.7 /opt/cassandra-1.0.1/thrift-0.7.0/
備註:
- 並非 thrift 必定得放在 cassandra 的目錄底下,而是因為版本有對應關係,因此這樣放比較不會搞錯
cd /opt/cassandra-1.0.1/thrift-0.7.0 bash ./contrib/fb303/bootstrap.sh ./configure make sudo make install
但從此之後有些怪怪的地方,如沒有
./compiler/cpp/thrift -gen php ../PATH-TO-CASSANDRA/interface/cassandra.thrift
可以產生 gen-php 的地方,以下的作法使用 thrift 0.6 搭配 cassandra 0.8 可行 https://wiki.fourkitchens.com/display/PF/Using+Cassandra+with+PHP
Attachments (1)
- Cassandra-PHP-Client-Library-exp.php (8.9 KB) - added by waue 13 years ago.
Download all attachments as: .zip