<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Chandler &#187; thrift</title>
	<atom:link href="http://chrischandler.name/tag/thrift/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrischandler.name</link>
	<description>Squandering time as a raving egomaniac</description>
	<lastBuildDate>Thu, 03 Jun 2010 23:16:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using HBase&#8217;s Thrift interface with Ruby</title>
		<link>http://chrischandler.name/ruby/using-hbases-thrift-interface-with-ruby/</link>
		<comments>http://chrischandler.name/ruby/using-hbases-thrift-interface-with-ruby/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 03:46:33 +0000</pubDate>
		<dc:creator>Chris Chandler</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[hbase]]></category>
		<category><![CDATA[thrift]]></category>

		<guid isPermaLink="false">http://chrischandler.name/?p=76</guid>
		<description><![CDATA[Using HBase's Thrift interface with Ruby the language and some basic examples.]]></description>
			<content:encoded><![CDATA[<p>In my continued fooling around with various key-value stores I&#8217;ve finally come across <a href="http://hadoop.apache.org/hbase/">HBase</a>.  Naturally, since I do my day-to-day programming in <a href="http://chrischandler.name/ruby/">Ruby</a> I wanted to setup some basic examples.  Though HBase does support a RESTful interface I thought I would get the <a href="http://incubator.apache.org/thrift/">Thrift</a> interface working for some better throughput.</p>
<p>If you need help Thrift running take a look at my post on <a href="http://chrischandler.name/ruby/using-cassandras-thrift-interface-with-ruby/">Cassandra&#8217;s thrift interface</a> that has all the prerequisites listed.</p>
<p>The example assumes a table &#8220;t1&#8243; and a column &#8220;f1&#8243;.</p>
<p><script src="http://gist.github.com/216619.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://chrischandler.name/ruby/using-hbases-thrift-interface-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Cassandra&#8217;s Thrift interface with Ruby</title>
		<link>http://chrischandler.name/ruby/using-cassandras-thrift-interface-with-ruby/</link>
		<comments>http://chrischandler.name/ruby/using-cassandras-thrift-interface-with-ruby/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 03:47:35 +0000</pubDate>
		<dc:creator>Chris Chandler</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[cassandra]]></category>
		<category><![CDATA[snow leopard]]></category>
		<category><![CDATA[thrift]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://chrischandler.name/?p=70</guid>
		<description><![CDATA[A quick example of how to use Cassandra's Thrift interface to connect with Ruby]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been trying to figure out how to work with <a href="incubator.apache.org/cassandra">Cassandra</a> then you&#8217;ve probably come across <a href="http://incubator.apache.org/thrift">Thrift</a>.  Thrift is a library written in the spirit of <a href="http://code.google.com/apis/protocolbuffers/">Google&#8217;s protocol buffers</a>, but developed by Facebook and then open-sourced in 2007.  The quick and short of it is that Thrift enables you to create RPC style calls in a platform-independent and XML-free way that is extremely efficient and surprisingly easy to work with once you get all the pieces working.</p>
<p><a href="http://jetfar.com">Rich Atkinson</a> already has a great blog post on how to get up and running with Thrift on <a href="http://jetfar.com/installing-cassandra-and-thrift-on-snow-leopard-a-quick-start-guide/">Snow Leopard</a>.  So if that&#8217;s what you&#8217;re running, I&#8217;m going to suggest you check it out.  If you&#8217;re running Ubuntu you&#8217;ll need to satisfy the following dependencies:</p>
<pre>sudo aptitude -q -y install libexpat1-dev libboost1.37-dev g++ autoconf automake libtool</pre>
<p>and the source can be obtained with:</p>
<pre>svn co http://svn.apache.org/repos/asf/incubator/thrift/trunk thrift</pre>
<p>and then you can proceed with the standard &#8220;configure &#038;&#038; make &#038;&#038; make install&#8221;.</p>
<p>Hopefully at this point you have the Thrift native libraries installed.  Since this is about Ruby, you should also install the Thrift gem that will take advantage of the native libraries.</p>
<pre>sudo gem install thrift</pre>
<p>Armed with both native library and gem, let&#8217;s go ahead and navigate to your Cassandra install&#8217;s interface directory (cassandra/interface) and build the ruby code:</p>
<pre>thrift --gen rb:new_style cassandra.thrift</pre>
<p>This will generate (as of this writing&#8230;) three files: gen-rb/cassandra.rb, gen-rb/cassandra_constants.rb, and gen-rb/cassandra_types.rb.  At this point you can create a temp.rb file in the gen-rb folder to play around with connections.  Here&#8217;s a short example of how to make a GET request for a specific key:</p>
<p><script src="http://gist.github.com/208103.js"></script></p>
<p>It&#8217;s worth noting that there *is* a gem available on github from <a href="http://github.com/fauna/cassandra">fauna/cassandra</a> that creates a much easier-to-work-with client, but since the interface for Cassandra is still evolving and changing the client is broken at the moment.  As far as I know this only applies to Cassandra 0.4.1 DEV and newer.  I&#8217;m very much looking forward to a working update.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrischandler.name/ruby/using-cassandras-thrift-interface-with-ruby/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
