grigoryvp
grigoryvp

Reputation: 42523

Is it possible to use Cassandra NoSQL database from Ruby?

I have tried to use a Ruby bindings for Cassandra database by installing binding:

sudo gem install cassandra

and attempting to load it:

require 'cassandra'

Unfortunately, this fails with error:

Gem::LoadError: RubyGem version error: thrift_client(0.8.1 not ~> 0.7.0)

I have fixed it by installing outdated dependency:

sudo gem install thrift_client -v "~> 0.7.0"

But after that another error is raised that i don't know how to fix:

LoadError: no such file to load -- thrift_client/connection

Tested on Ubuntu 11.10 and OSX 10.7, with both Ruby 1.8.7 and 1.9.3-p0. Is i something i'm doing wrong or Cassandra and Ruby are not intended to work together?

Upvotes: 1

Views: 977

Answers (3)

Jan Molak
Jan Molak

Reputation: 4536

Me and my team had plenty of problems with using the original cassandra gem. The gem seems to have been abandoned by the developers (last, 0.12.1, release happened on August 22, 2011) and is not compatible with thrift v0.8. Using thrift v0.7 was not an option for us as you can't compile it on Ubuntu without hacking some .c files, so we've decided to use mcmire-cassandra gem instead - http://rubygems.org/gems/mcmire-cassandra .

Even though mcmire did an excellent job with fixing the original gem, ruby client for cassandra is still behind the competition in terms of functionality provided. If you expect high load and need features like connection pooling for example you might consider using either Python or Java clients, which support it.

Hope this helps.

Upvotes: 2

phoet
phoet

Reputation: 18845

the latest commits on github indicate that they are going to push a new version soon. this one might not have the dependency problems mentioned.

i created a gist that should help you setup your project correctly: https://gist.github.com/1878226

Upvotes: 3

Alex Popescu
Alex Popescu

Reputation: 4002

I was wondering if using JRuby is an option for you? In that case you'd be able to use the Java client for Cassandra and I expect to have both better support and better results with it.

Upvotes: 0

Related Questions