sudo apt-get install libboost-dev automake libtool flex bison pkg-config g++ |
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel |
./configure make |
./compiler/cpp/thrift -gen php ../PATH-TO-CASSANDRA/interface/cassandra.thrift |
sudo mkdir -p /usr/share/php/Thrift sudo cp -R gen-php/ /usr/share/php/Thrift/packages/ sudo cp -R lib/php/src/* /usr/share/php/Thrift/ |
Installing and using the native PHP extension provides approximately a ten-fold performance boost on writing data. |
PATH-TO-THRIFT/lib/php/src/ext/thrift_protocol
.sudo apt-get install php5-dev |
sudo yum install php-devel |
phpize ./configure --enable-thrift_protocol make |
.so
to the extensions directory.
sudo cp modules/thrift_protocol.so /usr/lib/php5/20060613/ |
sudo cp modules/thrift_protocol.so /usr/lib64/php/modules/ |
extension=thrift_protocol.so |
extension=thrift_protocol.so |
php -i | grep -v "PWD" | grep "thrift_protocol" |
sudo /etc/init.d/apache2 restart |
sudo /etc/init.d/httpd restart |
TBinaryProtocolAccelerated
and not TBinaryProtocol
as the protocol.WHOAMI=`whoami` sudo mkdir /var/log/cassandra/ sudo chown $WHOAMI /var/log/cassandra/ sudo mkdir /var/lib/cassandra sudo chown $WHOAMI /var/lib/cassandra/ |
./bin/cassandra -f |
/var/www/cassandra-test.php
.http://localhost/cassandra-test.php
in the browser.While it's possible to use the low-level Thrift API, it's hard to learn and very inefficient as you will end up writing lots of code for very simple tasks such as fetching and reading data, it's advised to use some high-level client.
Good candidates include: