April 1, 2008

Berkeley DB Replication & Ruby on Leopard

I've been messing around with Berkeley DB & Ruby this evening as an experiment. I wanted to try out their replication support along with master election. This may wind up being a faster way of doing master election than the PAXOS library I wrote for ruby. Anyways, getting replication enabled in Ruby BDB on Leopard wasn't straightforward. The macports versions of Berkeley DB don't have threads enabled so the replication manager isn't there. So...

First build DB46 with threads

download db-4.6.21 from oracle

tar -zxf db-4.6.21.tar.gz
cd db-4.6.21/build_unix
../dist/configure --with-prefix=/usr/local --enable-cxx --disable-tcl --enable-pthread_api
make
sudo make install

Then build BDB

wget ftp://moulon.inra.fr/pub/ruby/bdb.tar.gz
tar -zxf bdb.tar.gz
cd bdb-0.6.2
ruby extconf.rb --with-db-dir=/usr/local/BerkeleyDB.4.6 --with-db-version=-4.6
make
sudo make install

You should now have a working Ruby/Berkely DB setup with replication working, hurray.

No comments: