Hi All, Many thanks for the responses. You helped enormously. I was in fact talking to the wrong port. It should have been 9160 rather than 8888. I just assumed that the port the cassandra server displayed when starting up was the one I should be talking to, my bad. I should have read the config file.
Once I have something working I'll write a new post back with a couple of examples here to help future newbies on how to talk to cassandra from erlang, since those examples are not present on the cassandra/thrift wiki as far as I can tell. Thanks, Jason On Thu, Mar 4, 2010 at 1:34 PM, <jeremey.barr...@nokia.com> wrote: > I think you want port 9160, not 8888... dt_socket != thrift. > > Jeremey. > > On Mar 4, 2010, at 2:02 AM, ext J T wrote: > > > Hi, > > > > 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 > /var/lib/cassandra/data/system/LocationInfo-9-Data.db > > 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: > > > > rr(cassandra_types). > > {ok, C} = thrift_client:start_link("localhost",8888, cassandra_thrift). > > thrift_client:call( C, > > 'insert', > > [ "Keyspace1", > > "1", > > #columnPath{column_family="Standard1", > column="email"}, > > "t...@example.com<mailto:t...@example.com>", > > 1, > > 1 > > ] ). > > > > 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, > > ["Keyspace1","1", > > {columnPath,"Standard1",undefined,"email"}, > > "t...@example.com<mailto:t...@example.com > >",1,1]} > > ** When Server state == {state,cassandra_thrift, > > {protocol,thrift_binary_protocol, > > {binary_protocol, > > > {transport,thrift_buffered_transport,<0.334.0>}, > > true,true}}, > > 0} > > ** Reason for termination == > > ** {{case_clause,{error,closed}}, > > [{thrift_client,read_result,3}, > > {thrift_client,catch_function_exceptions,2}, > > {thrift_client,handle_call,3}, > > {gen_server,handle_msg,5}, > > {proc_lib,init_p_do_apply,3}]} > > ** 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. > >