I've been trying to piece together some notion of how to use cassandra from
an erlang client.

So far I have managed to come up with the following, but it doesn't work.

Unfortunately there does not seem to be any decent documentation on the
subject I can find with googling so I'm hoping some more experienced members
of this mailing list can point out what I'm doing wrong.

I'm using cassandra 0.5, and I think the latest version of thrift.

I generated the thrift erlang client code using:

$ thrift -r --gen erl cassandra.thrift

And compiled and copied that into my ebin area, along with the rest of the
thrift erlc library code.

I start cassandra using its default config bin/cassandra -f and there are no
apparent errors:

$ bin/cassandra -f
Listening for transport dt_socket at address: 8888
INFO - Sampling index for
INFO - Replaying /var/lib/cassandra/commitlog/CommitLog-1267655779083.log
INFO - Log replay complete
INFO - Saved Token found: 141354730401634313333347303685581151939
INFO - Starting up server gossip
INFO - Cassandra starting up...

then after a few seconds, it displays this:

Debugger failed to attach: timeout during handshake

Then from an erl vm I try the following:

{ok, C} = thrift_client:start_link("localhost",8888, cassandra_thrift).
thrift_client:call( C,
                   [ "Keyspace1",
                     #columnPath{column_family="Standard1", column="email"},
                     ] ).

Unfortunately, although I get a cassandra_thrift client connection, the call
to insert fails with :

=ERROR REPORT==== 4-Mar-2010::07:57:50 ===
** Generic server <0.333.0> terminating
** Last message in was {call,insert,
** When Server state == {state,cassandra_thrift,
** Reason for termination ==
** {{case_clause,{error,closed}},
** exception exit: {case_clause,{error,closed}}
     in function  thrift_client:read_result/3
     in call from thrift_client:catch_function_exceptions/2
     in call from thrift_client:handle_call/3
     in call from gen_server:handle_msg/5
     in call from proc_lib:init_p_do_apply/3

Cassandra itself reports nothing.

-- JT.

Reply via email to