The most common way to access Cassandra is via the Thrift interface.

In short Thrift allows you easily setup service clients and servers in various programming languages. It generates code from a Thrift file describing the service. See Cassandra's Thrift file here.

Let's see how we can use a generated python client to access Cassandra.

  1. Download Thrift and install it

  2. cd cassandra/interface
  3. thrift -gen py cassandra.thrift
  4. cd gen-py/cassandra

Run the script without arguments to get usage information:

Usage: ./Cassandra-remote [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]

Some examples of setting and getting values:

$ ./Cassandra-remote -h cass-1:9160 insert Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" apple 1 ConsistencyLevel.QUORUM
None
$ ./Cassandra-remote -h cass-1:9160 get Keyspace1 eevans "ColumnPath('Standard1', column='fruit')" ConsistencyLevel.QUORUM
ColumnOrSuperColumn(column=Column(timestamp=1, name='fruit', value='apple'), super_column=None)

See API for details on using the interface.

ThriftInterface (last edited 2009-10-10 15:58:24 by JonathanEllis)