Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  1. Change to the thrift directory
  2. Install build dependencies.
    • On Ubuntu:
      No Format
      sudo apt-get install libboost-dev automake libtool flex bison pkg-config g++
      
    • On RHEL 5 or CentOS 5:
      No Format
      sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel
      
  3. Configure and build Thrift:
    No Format
    ./configure
    make
    
  4. Build the PHP Thrift interface for Cassandra:
    No Format
    ./compiler/cpp/thrift -gen php ../PATH-TO-CASSANDRA/interface/cassandra.thrift
    
  5. Copy the include files to a useful place (per the Cassandra "Getting Started" guide):
    No Format
    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/
    

...

  1. Copy in the PHP from the Cassandra client examples page to /var/www/cassandra-test.php.
  2. Visit http://localhost/cassandra-test.php in the browser.
  3. On the first load, the array output should be empty. On the second, there should be content.

Consider using higher-level clients

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: