wiki:waue/2011/1107

Version 13 (modified by waue, 12 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

  • 順便對照以前寫得內容

hadoop + Hbase + thrift + php 安裝設定與程式設計

安裝

  • 下載 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
    
    
    
  • 下載 Cassandra-PHP-Client-Library (下載) ,解壓縮到 /var/www/cassandra/ 下
  • 驗證
bin/cassandra-cli -h localhost

use CassandraExample;
show schema;
list user;


cassandra 1.0 + Thrift 0.7
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)

Download all attachments as: .zip