Compiling ThruDB on OSX

After successfully installing thrift there are still a string of dependencies needed before you can install ThruDB.

Thanks in no small part to Jake Luciani for helping me with finding the dependencies.

MacPorts

First we need several packages from the macports. You may want to run sudo port selfupdate to get the latest versions of those packages.


sudo port install boost clucene libevent memcached ossp-uuid

I hit a weird compile error on boost. I fixed it by running sudo port clean boost and simply re-running the port install command. Same problem on both my machines.

Manual dependencies

Like mentioned above, we need facebook’s thrift. We will their public SVN version because this fixes a bug which makes compiling on OSX easier.

svn co http://svn.facebook.com/svnroot/thrift/trunk/ thrift
cd thrift; ./bootstrap.sh
./configure --with-boost=/opt/local --with-libevent=/opt/local --prefix=/opt/local
sudo make install

Don’t forget to install the thrift ruby libraries:

cd thrift/lib/rb
ruby setup.rb

Next we need spread. Spread is a message bus which works much like you imagine a network of IRC server to work. ThruDB uses it for replication and two-phase commits amongst other things. Its a remarkable piece of software which should find its way in most server farms, regardless of ThruDB’s use or not. Once common usecase is to broadcast server logs to spread. This allows you to write a simple client which just listens to the messages and calculates user statistics, traffic and so on. Its also great for replication and keeping multiple systems in sync, such as a search server and the main database.

Unfortunately the spread team decided that everyone who wants to install it has to fill out a quick form so you will have to manually download it from http://www.spread.org/download/spread-src-4.0.0.tar.gz.

tar zxf spread-src-4.0.0
./configure --prefix=/opt/local 
make
sudo make install

ThruDB makes heavy usage of memcached, therefore it uses the up-and-coming c library by Brian Aker which is quickly establishing itself as the defacto standard client implementation due to its speed and use of Consistent Hashing. I actually wrote a ruby extension for this client library with some very encouraging performance metrics. I hope to release this soon.

curl http://download.tangent.org/libmemcached-0.12.tar.gz > libmemcached-0.12.tar.gz
tar zxf libmemcached-0.12.tar.gz
cd libmemcached-0.12
./configure --prefix=/opt/local
sudo make install

Lastly there is log4cxx to be installed. This is a pretty heavy library because of its use of apache apr. Jake said that he may dump it in an upcoming release to make the dependencies of ThruDB a bit more sane.

svn checkout http://svn.apache.org/repos/asf/logging/log4cxx/trunk apache-log4cxx
cd apache-log4cxx
./autogen.sh
./configure --prefix=/opt/local
sudo make install

Compiling ThruDB

svn co http://thrudb.googlecode.com/svn/trunk thrudb
cd thrudb; ./autogen.sh
env LDFLAGS="-L/opt/local/lib" CPPFLAGS="-I/opt/local/lib -I/opt/local/include -I/opt/local/include/thrift" ./configure --prefix=/opt/local
sudo make install

If the compile fails with a missing thriftnb library than you didn’t compile thrift with—with-libevent=/opt/local . Just do that again, we’ll wait.

ThruDB & ruby.

# Run memcached server
memcached -d
# Setup lib shenanigans
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/opt/local/lib/

#run thrudb tutorials
cd tutorial

# create the ruby client for the bookmarks.thrift service
make

# start thrudb
./thrudbctl start

# run the tutorial
cd rb; ruby BookmarkExample.rb 

# Profit! (to quote Jake) 

Posted by tobi — 01:09 PM Dec 31

12 comments (closed) Filed under: Testing

Compiling Thrift on OSX

Compiling thrift on OSX can be a bit of a hassle because of some POSIX discrepancies.

sudo port install boost 

tar xfz thrift-*
cd thirft-*
curl http://blog.leetsoft.com/files/patches/thrift.patch | patch -p1
./configure --with-boost=/opt/local  --prefix=/opt/local
make
sudo make install 

Update: Installing from SVN is doesn’t require the patch above so I’m recommending to do that now:

svn co http://svn.facebook.com/svnroot/thrift/trunk/ thrift
cd thrift; sh bootstrap.sh
./configure --with-boost=/opt/local --with-libevent=/opt/local --prefix=/opt/local
sudo make install

To install the ruby libs for thrift simply do:

cd lib/rb
ruby setup.rb

Posted by tobi — 12:30 PM Dec 30

2 comments (closed) Filed under: Testing

Futuretalk: ThruDB

Igvita shares the details on ThruDB, another take on the document storage paradigm.

Article: ThruDB, faster and cheaper than SimpleDB

The architecture sound incredible. Amongst others there is the rank and file of the high scalability open source software such as memcached, spread, CLucene and facebook’s newcomer thrift for wire protocols.

ThruDB is able to use Amazon S3 as a permanent data store which makes it an ideal fit for EC2 installations. For quick document access its able to utilize the local disks and even memcached.

Everything about ThruDB’s design is genius. The innovation here is that it separates the concerns of permanent document storage and querys. For querying documents it uses the lucene fulltext search engine. CLucene is naturally more suited for the requirements of a web application. SQL cannot compete with the quality and features of lucene for query and lookup.

In the end you have something more safe, more scalable and much faster than a traditional RBMS with the added benefit of world class full text search.

Cheers Jake.

Posted by tobi — 12:36 PM Dec 28

3 comments (closed) Filed under: Testing