NOTE: If you arrived here for the purpose of writing your first application, please consider using a higher-level client instead of thrift directly.
Thrift historically did not have tagged releases and Cassandra used trunk revisions of it however as of Cassandra 0.8, Thrift 0.6 is used and available for download. With Cassandra 0.7, Thrift 0.5 is used. For Cassandra 0.6, you have to use the matching version of Thrift. Under such circumstances, installing thrift is a bit of a bitch. We are sorry about that, but we don't know of a better way to support a vast number of clients mostly automagically.
If installing Thrift 0.6 on a Mac for use with Cassandra 0.8 and you get an error building 'thrift.protocol.fastbinary' extension during make
then you might need to work around https://issues.apache.org/jira/browse/THRIFT-1143 by going to thrift-0.6.1/lib/py and run sudo ARCHFLAGS="-arch x86_64" python setup.py install
Important note: If using Cassandra 0.6 then you need to install the svn revision of thrift that matches the revision that your version of Cassandra uses (if not using 0.8 with Thrift 0.6 nor 0.7 with Thrift 0.5). This can be found in the <Cassandra Home>/lib directory - e.g. libthrift-917130.jar
means that version of Cassandra uses svn revision 917130 of thrift.
aptitude install libboost-dev python-dev autoconf automake pkg-config make libtool flex bison build-essential
(or the equivalent on your system) (assumes you are interested in building for python; omit python-dev otherwise)- Grab the thrift source with the revision that your version of Cassandra uses: e.g.
svn co -r 917130 http://svn.apache.org/repos/asf/thrift/trunk thrift
cd thrift
./bootstrap.sh
./configure
(you may need to add--without-ruby
or--without-csharp
or any other targets that are giving you trouble)make
make install
- install any client libraries, e.g., for python,
cd thrift/lib/py && python setup.py install
)
Note: on the mac, you may have to comment out a few lines of the configure
file. The lines to comment out look something like this:
if test "$with_csharp" = "yes"; then PKG_CHECK_MODULES(MONO, mono >= 2.0.0, net_3_5=yes, net_3_5=no) PKG_CHECK_MODULES(MONO, mono >= 1.2.4, have_mono=yes, have_mono=no) fi
Note for OSX users: Snow Leopard comes with dated versions of autoconf and automake which need to be updated. Check this blog post for a nice easy script to fix that problem: http://eclecticengineer.blogspot.com/2010/03/install-thrift-on-osx-snow-leopard.html