Skip to content
A Ruby client for the Cassandra distributed database.
Ruby Shell
Pull request Compare This branch is 537 commits behind cassandra-rb:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A Ruby client for the Cassandra distributed database. 

== License

Copyright 2009 Twitter, Inc. See included LICENSE file. Portions copyright 2004-2009 David Heinemeier Hansson, and used with permission.

The public certificate for this gem is here[]. 

== Features

* clean encapsulation of the Thrift API
* compatible UUID and Long classes, for GUID generation
* Ruby 1.9 compatibility

The Github source repository is {here}[]. Patches and contributions are very welcome.

== Installation

You need Ruby 1.8 or 1.9. If you have those, just run:

  sudo gem install cassandra
Cassandra itself is a rapidly moving target. In order to get a working server, use the <tt>bin/cassandra_helper</tt> script:

  cassandra_helper cassandra
A server will be installed in <tt>$HOME/cassandra/server</tt>, and started in debug mode.

== Usage
Now, start IRb and require the library:
  require 'cassandra'
Connect to a server and keyspace:
  client ='Twitter', '')
Insert into a column family. You can insert a Cassandra::OrderedHash, or a regular Hash, if order doesn't matter:

  client.insert(:Users, "5", {'screen_name' => "buttonscat"})  

Insert into a super column family:

  client.insert(:UserRelationships, "5", {"user_timeline" => { => "1"}})

Query a super column:

  timeline = client.get(:UserRelationships, "5", "user_timeline")
The returned result will always be a Cassandra::OrderedHash.

See Cassandra for more methods.

== Further reading

* {Up and Running With Cassandra}[]

== Reporting problems

The Github issue tracker is {here}[]. If you have problems with Cassandra itself, please use the {cassandra-user mailing list}[].

Something went wrong with that request. Please try again.